// File: /workspace/github_c_makefile_star2_O0/Keith-S-Thompson[P]kst-time-utils/timer.c
// Function: main
int main(int argc, char **argv) {
#define LEN 8192

    char line[LEN];
    int i;
    char *output_file_name = NULL;
    FILE *output_file = stdout;

    for (i = 1; i < argc; i ++) {
        if (strcmp(argv[i], "-a") == 0) {
            absolute = true;
        }
        else if (strcmp(argv[i], "-A") == 0) {
            absolute_readable = true;
            utc = false;
        }
        else if (strcmp(argv[i], "-U") == 0) {
            absolute_readable = true;
            utc = true;
        }
        else if (strcmp(argv[i], "-r") == 0) {
            relative = true;
        }
        else if (strcmp(argv[i], "-z") == 0) {
            absolute = false;
        }
        else if (strcmp(argv[i], "-b") == 0) {
            buffered = true;
        }
        else if (strcmp(argv[i], "-u") == 0) {
            buffered = false;
        }
        else if (strcmp(argv[i], "-o") == 0) {
            if (i < argc-1) {
                output_file_name = argv[i+1];
                i ++;
            }
            else {
                usage(argv[0], "Option -o requires a file name argument");
            }
        }
        else if (strcmp(argv[i], "-h") == 0) {
            usage(argv[0], NULL);
        }
        else {
            char message[100];
            sprintf(message, "Unrecognized argument: \"%s\"", argv[i]);
            usage(argv[0], message);
        }
    }

    if (absolute && relative) {
        usage(argv[0], "Options -a and -r are incompatible");
    }

    if (output_file_name != NULL) {
        output_file = fopen(output_file_name, "w");
        if (output_file == NULL) {
            perror(output_file_name);
            exit(EXIT_FAILURE);
        }
    }


    if (! buffered) {
        setbuf(output_file, NULL);
    }

    show_time(output_file, true);
    putc('\n', output_file);

    while (fgets(line, LEN, stdin)) {
        show_time(output_file, false);
        fprintf(output_file, " %s", line);
    }

    show_time(output_file, true);
    putc('\n', output_file);
    
    if (output_file_name != NULL) {
        fclose(output_file);
    }

    exit(EXIT_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2090, %rsp           # imm = 0x2090
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x2020(%rbp)
movq 0x2d85(%rip), %rax      # 0x3fd0
movq (%rax), %rax
movq %rax, -0x2028(%rbp)
movl $0x1, -0x2014(%rbp)
movl -0x2014(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x14b0
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd80(%rip), %rsi       # 0x2004
callq 0x10a0
cmpl $0x0, %eax
jne 0x129a
movb $0x1, 0x2e13(%rip)      # 0x40a8
jmp 0x149a
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd57(%rip), %rsi       # 0x2007
callq 0x10a0
cmpl $0x0, %eax
jne 0x12cd
movb $0x1, 0x2de8(%rip)      # 0x40a9
movb $0x0, 0x2de2(%rip)      # 0x40aa
jmp 0x1498
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd27(%rip), %rsi       # 0x200a
callq 0x10a0
cmpl $0x0, %eax
jne 0x1300
movb $0x1, 0x2db5(%rip)      # 0x40a9
movb $0x1, 0x2daf(%rip)      # 0x40aa
jmp 0x1496
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xcf7(%rip), %rsi       # 0x200d
callq 0x10a0
cmpl $0x0, %eax
jne 0x132c
movb $0x1, 0x2d84(%rip)      # 0x40ab
jmp 0x1494
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xcce(%rip), %rsi       # 0x2010
callq 0x10a0
cmpl $0x0, %eax
jne 0x1358
movb $0x0, 0x2d55(%rip)      # 0x40a8
jmp 0x1492
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xca5(%rip), %rsi       # 0x2013
callq 0x10a0
cmpl $0x0, %eax
jne 0x1384
movb $0x1, 0x2d2d(%rip)      # 0x40ac
jmp 0x1490
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xc7c(%rip), %rsi       # 0x2016
callq 0x10a0
cmpl $0x0, %eax
jne 0x13b0
movb $0x0, 0x2d01(%rip)      # 0x40ac
jmp 0x148e
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xc53(%rip), %rsi       # 0x2019
callq 0x10a0
cmpl $0x0, %eax
jne 0x1421
movl -0x2014(%rbp), %eax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x140c
movq -0x10(%rbp), %rax
movl -0x2014(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x2020(%rbp)
movl -0x2014(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2014(%rbp)
jmp 0x141f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xc02(%rip), %rsi       # 0x201c
callq 0x15f0
jmp 0x148c
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xc0d(%rip), %rsi       # 0x2044
callq 0x10a0
cmpl $0x0, %eax
jne 0x1453
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x15f0
jmp 0x148a
leaq -0x2090(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x2014(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0xbd7(%rip), %rsi       # 0x2047
movb $0x0, %al
callq 0x1100
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x2090(%rbp), %rsi
callq 0x15f0
jmp 0x148c
jmp 0x148e
jmp 0x1490
jmp 0x1492
jmp 0x1494
jmp 0x1496
jmp 0x1498
jmp 0x149a
jmp 0x149c
movl -0x2014(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2014(%rbp)
jmp 0x125f
testb $0x1, 0x2bf1(%rip)      # 0x40a8
je 0x14d5
testb $0x1, 0x2beb(%rip)      # 0x40ab
je 0x14d5
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xb93(%rip), %rsi       # 0x2063
callq 0x15f0
cmpq $0x0, -0x2020(%rbp)
je 0x151b
movq -0x2020(%rbp), %rdi
leaq 0xb99(%rip), %rsi       # 0x2086
callq 0x10e0
movq %rax, -0x2028(%rbp)
cmpq $0x0, -0x2028(%rbp)
jne 0x1519
movq -0x2020(%rbp), %rdi
callq 0x10f0
movl $0x1, %edi
callq 0x1110
jmp 0x151b
testb $0x1, 0x2b8a(%rip)      # 0x40ac
jne 0x1534
movq -0x2028(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1050
movq -0x2028(%rbp), %rdi
movl $0x1, %esi
callq 0x16a0
movq -0x2028(%rbp), %rsi
movl $0xa, %edi
callq 0x10b0
leaq -0x2010(%rbp), %rdi
movq 0x2a74(%rip), %rax      # 0x3fd8
movq (%rax), %rdx
movl $0x2000, %esi           # imm = 0x2000
callq 0x1090
cmpq $0x0, %rax
je 0x15a3
movq -0x2028(%rbp), %rdi
xorl %esi, %esi
callq 0x16a0
movq -0x2028(%rbp), %rdi
leaq -0x2010(%rbp), %rdx
leaq 0xaee(%rip), %rsi       # 0x2088
movb $0x0, %al
callq 0x10c0
jmp 0x1556
movq -0x2028(%rbp), %rdi
movl $0x1, %esi
callq 0x16a0
movq -0x2028(%rbp), %rsi
movl $0xa, %edi
callq 0x10b0
cmpq $0x0, -0x2020(%rbp)
je 0x15db
movq -0x2028(%rbp), %rdi
callq 0x1040
xorl %edi, %edi
callq 0x1110
nopw %cs:(%rax,%rax)