.arch armv8-a .file "commands.c" .text .section .rodata .align 3 .LC0: .string "Unix Timestamp: %lld\n" .text .align 2 .global _unix .type _unix, %function _unix: .LFB6: .cfi_startproc stp x29, x30, [sp, -32]! .cfi_def_cfa_offset 32 .cfi_offset 29, -32 .cfi_offset 30, -24 mov x29, sp mov x0, 0 bl time str x0, [sp, 24] ldr x1, [sp, 24] adrp x0, .LC0 add x0, x0, :lo12:.LC0 bl printf nop ldp x29, x30, [sp], 32 .cfi_restore 30 .cfi_restore 29 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE6: .size _unix, .-_unix .section .rodata .align 3 .LC1: .string "." .align 3 .LC2: .string "Failed to open directory" .align 3 .LC3: .string ".." .align 3 .LC4: .string "realloc" .align 3 .LC5: .string "strdup" .align 3 .LC6: .string "%s%s\n" .text .align 2 .global ls .type ls, %function ls: .LFB7: .cfi_startproc stp x29, x30, [sp, -80]! .cfi_def_cfa_offset 80 .cfi_offset 29, -80 .cfi_offset 30, -72 mov x29, sp str x19, [sp, 16] .cfi_offset 19, -64 str xzr, [sp, 72] str xzr, [sp, 64] adrp x0, .LC1 add x0, x0, :lo12:.LC1 bl opendir str x0, [sp, 48] ldr x0, [sp, 48] cmp x0, 0 bne .L5 adrp x0, .LC2 add x0, x0, :lo12:.LC2 bl puts b .L2 .L8: ldr x0, [sp, 40] add x2, x0, 19 adrp x0, .LC1 add x1, x0, :lo12:.LC1 mov x0, x2 bl strcmp cmp w0, 0 beq .L5 ldr x0, [sp, 40] add x2, x0, 19 adrp x0, .LC3 add x1, x0, :lo12:.LC3 mov x0, x2 bl strcmp cmp w0, 0 beq .L5 ldr x0, [sp, 64] add x0, x0, 1 lsl x0, x0, 3 mov x1, x0 ldr x0, [sp, 72] bl realloc str x0, [sp, 72] ldr x0, [sp, 72] cmp x0, 0 bne .L6 adrp x0, .LC4 add x0, x0, :lo12:.LC4 bl perror ldr x0, [sp, 48] bl closedir b .L2 .L6: ldr x0, [sp, 40] add x2, x0, 19 ldr x0, [sp, 64] lsl x0, x0, 3 ldr x1, [sp, 72] add x19, x1, x0 mov x0, x2 bl strdup str x0, [x19] ldr x0, [sp, 64] lsl x0, x0, 3 ldr x1, [sp, 72] add x0, x1, x0 ldr x0, [x0] cmp x0, 0 bne .L7 adrp x0, .LC5 add x0, x0, :lo12:.LC5 bl perror ldr x0, [sp, 48] bl closedir b .L2 .L7: ldr x0, [sp, 64] add x0, x0, 1 str x0, [sp, 64] .L5: ldr x0, [sp, 48] bl readdir str x0, [sp, 40] ldr x0, [sp, 40] cmp x0, 0 bne .L8 ldr x0, [sp, 48] bl closedir adrp x3, :got:compareStrings;ldr x3, [x3, :got_lo12:compareStrings] mov x2, 8 ldr x1, [sp, 64] ldr x0, [sp, 72] bl qsort str xzr, [sp, 56] b .L9 .L10: ldr x0, [sp, 56] lsl x0, x0, 3 ldr x1, [sp, 72] add x0, x1, x0 ldr x19, [x0] ldr x0, [sp, 56] lsl x0, x0, 3 ldr x1, [sp, 72] add x0, x1, x0 ldr x0, [x0] bl getTypeSuffix mov x2, x0 mov x1, x19 adrp x0, .LC6 add x0, x0, :lo12:.LC6 bl printf mov w0, 5000 bl usleep ldr x0, [sp, 56] lsl x0, x0, 3 ldr x1, [sp, 72] add x0, x1, x0 ldr x0, [x0] bl free ldr x0, [sp, 56] add x0, x0, 1 str x0, [sp, 56] .L9: ldr x1, [sp, 56] ldr x0, [sp, 64] cmp x1, x0 bcc .L10 ldr x0, [sp, 72] bl free .L2: ldr x19, [sp, 16] ldp x29, x30, [sp], 80 .cfi_restore 30 .cfi_restore 29 .cfi_restore 19 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE7: .size ls, .-ls .section .rodata .align 3 .LC7: .string "clock_gettime" .align 3 .LC8: .string "localtime_r" .align 3 .LC9: .string "%a %b %d %H:%M:%S %Z %Y" .align 3 .LC10: .string "strftime returned 0\n" .text .align 2 .global date .type date, %function date: .LFB8: .cfi_startproc stp x29, x30, [sp, -192]! .cfi_def_cfa_offset 192 .cfi_offset 29, -192 .cfi_offset 30, -184 mov x29, sp add x0, sp, 176 mov x1, x0 mov w0, 0 bl clock_gettime cmn w0, #1 bne .L12 adrp x0, .LC7 add x0, x0, :lo12:.LC7 bl perror b .L11 .L12: add x1, sp, 120 add x0, sp, 176 bl localtime_r cmp x0, 0 bne .L14 adrp x0, .LC8 add x0, x0, :lo12:.LC8 bl perror b .L11 .L14: add x0, sp, 120 add x4, sp, 16 mov x3, x0 adrp x0, .LC9 add x2, x0, :lo12:.LC9 mov x1, 100 mov x0, x4 bl strftime cmp x0, 0 bne .L15 adrp x0, :got:stderr;ldr x0, [x0, :got_lo12:stderr] ldr x0, [x0] mov x3, x0 mov x2, 20 mov x1, 1 adrp x0, .LC10 add x0, x0, :lo12:.LC10 bl fwrite b .L11 .L15: add x0, sp, 16 bl puts .L11: ldp x29, x30, [sp], 192 .cfi_restore 30 .cfi_restore 29 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE8: .size date, .-date .section .rodata .align 3 .LC11: .string "USER" .align 3 .LC12: .string "Failed to get username." .text .align 2 .global whoami .type whoami, %function whoami: .LFB9: .cfi_startproc stp x29, x30, [sp, -32]! .cfi_def_cfa_offset 32 .cfi_offset 29, -32 .cfi_offset 30, -24 mov x29, sp adrp x0, .LC11 add x0, x0, :lo12:.LC11 bl getenv str x0, [sp, 24] ldr x0, [sp, 24] cmp x0, 0 beq .L18 ldr x0, [sp, 24] bl puts b .L20 .L18: adrp x0, .LC12 add x0, x0, :lo12:.LC12 bl perror .L20: nop ldp x29, x30, [sp], 32 .cfi_restore 30 .cfi_restore 29 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE9: .size whoami, .-whoami .section .rodata .align 3 .LC13: .string "r" .align 3 .LC14: .string "cat" .align 3 .LC15: .string "%s" .text .align 2 .global cat .type cat, %function cat: .LFB10: .cfi_startproc stp x29, x30, [sp, -304]! .cfi_def_cfa_offset 304 .cfi_offset 29, -304 .cfi_offset 30, -296 mov x29, sp str x0, [sp, 24] adrp x0, .LC13 add x1, x0, :lo12:.LC13 ldr x0, [sp, 24] bl fopen str x0, [sp, 296] ldr x0, [sp, 296] cmp x0, 0 bne .L24 adrp x0, .LC14 add x0, x0, :lo12:.LC14 bl perror b .L21 .L25: add x0, sp, 40 mov x1, x0 adrp x0, .LC15 add x0, x0, :lo12:.LC15 bl printf .L24: add x0, sp, 40 ldr x2, [sp, 296] mov w1, 256 bl fgets cmp x0, 0 bne .L25 ldr x0, [sp, 296] bl fclose .L21: ldp x29, x30, [sp], 304 .cfi_restore 30 .cfi_restore 29 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE10: .size cat, .-cat .section .rodata .align 3 .LC16: .string "nl" .align 3 .LC17: .string "%6d\t%s" .text .align 2 .global nl .type nl, %function nl: .LFB11: .cfi_startproc stp x29, x30, [sp, -304]! .cfi_def_cfa_offset 304 .cfi_offset 29, -304 .cfi_offset 30, -296 mov x29, sp str x0, [sp, 24] adrp x0, .LC13 add x1, x0, :lo12:.LC13 ldr x0, [sp, 24] bl fopen str x0, [sp, 288] ldr x0, [sp, 288] cmp x0, 0 bne .L27 adrp x0, .LC16 add x0, x0, :lo12:.LC16 bl perror b .L26 .L27: mov w0, 1 str w0, [sp, 300] b .L29 .L30: ldr w0, [sp, 300] add w1, w0, 1 str w1, [sp, 300] add x1, sp, 32 mov x2, x1 mov w1, w0 adrp x0, .LC17 add x0, x0, :lo12:.LC17 bl printf .L29: add x0, sp, 32 ldr x2, [sp, 288] mov w1, 256 bl fgets cmp x0, 0 bne .L30 ldr x0, [sp, 288] bl fclose .L26: ldp x29, x30, [sp], 304 .cfi_restore 30 .cfi_restore 29 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE11: .size nl, .-nl .section .rodata .align 3 .LC18: .string "HOME" .align 3 .LC19: .string "cd: HOME not set\n" .align 3 .LC20: .string "cd" .text .align 2 .global cd .type cd, %function cd: .LFB12: .cfi_startproc stp x29, x30, [sp, -48]! .cfi_def_cfa_offset 48 .cfi_offset 29, -48 .cfi_offset 30, -40 mov x29, sp str x0, [sp, 24] ldr x0, [sp, 24] cmp x0, 0 bne .L32 adrp x0, .LC18 add x0, x0, :lo12:.LC18 bl getenv str x0, [sp, 40] ldr x0, [sp, 40] cmp x0, 0 bne .L33 adrp x0, :got:stderr;ldr x0, [x0, :got_lo12:stderr] ldr x0, [x0] mov x3, x0 mov x2, 17 mov x1, 1 adrp x0, .LC19 add x0, x0, :lo12:.LC19 bl fwrite b .L31 .L33: ldr x0, [sp, 40] str x0, [sp, 24] .L32: ldr x0, [sp, 24] bl chdir cmp w0, 0 beq .L31 adrp x0, .LC20 add x0, x0, :lo12:.LC20 bl perror .L31: ldp x29, x30, [sp], 48 .cfi_restore 30 .cfi_restore 29 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE12: .size cd, .-cd .section .rodata .align 3 .LC21: .string "fork" .align 3 .LC22: .string "execvp" .align 3 .LC23: .string "waitpid" .text .align 2 .global execute_program .type execute_program, %function execute_program: .LFB13: .cfi_startproc stp x29, x30, [sp, -48]! .cfi_def_cfa_offset 48 .cfi_offset 29, -48 .cfi_offset 30, -40 mov x29, sp str x0, [sp, 24] str x1, [sp, 16] bl fork str w0, [sp, 44] ldr w0, [sp, 44] cmn w0, #1 bne .L36 adrp x0, .LC21 add x0, x0, :lo12:.LC21 bl perror b .L35 .L36: ldr w0, [sp, 44] cmp w0, 0 bne .L38 ldr x1, [sp, 16] ldr x0, [sp, 24] bl execvp adrp x0, .LC22 add x0, x0, :lo12:.LC22 bl perror mov w0, 1 bl exit .L38: add x0, sp, 40 mov w2, 0 mov x1, x0 ldr w0, [sp, 44] bl waitpid cmn w0, #1 bne .L35 adrp x0, .LC23 add x0, x0, :lo12:.LC23 bl perror .L35: ldp x29, x30, [sp], 48 .cfi_restore 30 .cfi_restore 29 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE13: .size execute_program, .-execute_program .section .rodata .align 3 .LC24: .string "Available commands:" .align 3 .LC25: .string "exit" .align 3 .LC26: .string "test" .align 3 .LC27: .string "clear" .align 3 .LC28: .string "unix" .align 3 .LC29: .string "ls" .align 3 .LC30: .string "date" .align 3 .LC31: .string "whoami" .align 3 .LC32: .string "help" .align 3 .LC33: .string "exec" .text .align 2 .global help .type help, %function help: .LFB14: .cfi_startproc stp x29, x30, [sp, -16]! .cfi_def_cfa_offset 16 .cfi_offset 29, -16 .cfi_offset 30, -8 mov x29, sp adrp x0, .LC24 add x0, x0, :lo12:.LC24 bl puts adrp x0, .LC25 add x0, x0, :lo12:.LC25 bl puts adrp x0, .LC26 add x0, x0, :lo12:.LC26 bl puts adrp x0, .LC27 add x0, x0, :lo12:.LC27 bl puts adrp x0, .LC28 add x0, x0, :lo12:.LC28 bl puts adrp x0, .LC29 add x0, x0, :lo12:.LC29 bl puts adrp x0, .LC30 add x0, x0, :lo12:.LC30 bl puts adrp x0, .LC31 add x0, x0, :lo12:.LC31 bl puts adrp x0, .LC14 add x0, x0, :lo12:.LC14 bl puts adrp x0, .LC16 add x0, x0, :lo12:.LC16 bl puts adrp x0, .LC20 add x0, x0, :lo12:.LC20 bl puts adrp x0, .LC32 add x0, x0, :lo12:.LC32 bl puts adrp x0, .LC33 add x0, x0, :lo12:.LC33 bl puts nop ldp x29, x30, [sp], 16 .cfi_restore 30 .cfi_restore 29 .cfi_def_cfa_offset 0 ret .cfi_endproc .LFE14: .size help, .-help .ident "GCC: (Debian 14.2.0-19) 14.2.0" .section .note.GNU-stack,"",@progbits