// File: /workspace/github_c_makefile_star2_O0/ikbenlike[P]nngutils/src/cat.c
// Function: print_file
int print_file(int fd, struct cat_args *args, char *name){
    int endchar;
    static unsigned long int nline = 0;
    char *buf = calloc(1, 4096 * sizeof(char));
    if(buf == NULL){
        fprintf(stderr, "%s: %s\n", name, strerror(errno));
        exit(1);
    }
    int buf_len = read(fd, buf, 4096);
    if(args->number){
        if(nline < 9){
            printf("     %lu  ", ++nline);
        }
        else if(nline < 99){
            printf("    %lu  ", ++nline);
        }
        else if(nline < 999){
            printf("   %lu  ", ++nline);
        }
        else if(nline < 9999){
            printf("  %lu  ", ++nline);
        }
        else if(nline < 99999){
            printf(" %lu  ", ++nline);
        }
        else{ 
            printf("%lu  ", ++nline);
        }
    }
    while(buf_len != 0){
        for(int i = 0; i < buf_len; i++){
            if(args->show_ends && buf[i] == '\n'){
                fputc('$', stdout);
            }
            if(args->show_tabs && buf[i] == '\t'){
                fputs("^I", stdout);
                continue;
            }
            if(args->number && buf[i] == '\n' && i + 1 < buf_len){
                fputc(buf[i], stdout);
                if(nline < 9){
                    printf("     %lu  ", ++nline);
                }
                else if(nline < 99){
                    printf("    %lu  ", ++nline);
                }
                else if(nline < 999){
                    printf("   %lu  ", ++nline);
                }
                else if(nline < 9999){
                    printf("  %lu  ", ++nline);
                }
                else if(nline < 99999){
                    printf(" %lu  ", ++nline);
                }
                else{ 
                    printf("%lu  ", ++nline);
                }
                continue;
            }
            fputc(buf[i], stdout);
        }
        buf_len = read(fd, buf, 4096);
    }
    free(buf);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x1, %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0x10c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1622
movq 0x2a14(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x1040
movl (%rax), %edi
callq 0x1110
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq %rax, %rcx
leaq 0xa8d(%rip), %rsi       # 0x209e
movb $0x0, %al
callq 0x10e0
movl $0x1, %edi
callq 0x1100
movl -0x4(%rbp), %edi
movq -0x28(%rbp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x10b0
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x3(%rax)
je 0x175c
cmpq $0x9, 0x2a5c(%rip)      # 0x40a8
jae 0x1673
movq 0x2a53(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x2a48(%rip)      # 0x40a8
leaq 0xa3f(%rip), %rdi       # 0x20a6
movb $0x0, %al
callq 0x1070
jmp 0x175a
cmpq $0x63, 0x2a2d(%rip)     # 0x40a8
jae 0x16a2
movq 0x2a24(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x2a19(%rip)      # 0x40a8
leaq 0xa11(%rip), %rdi       # 0x20a7
movb $0x0, %al
callq 0x1070
jmp 0x1758
cmpq $0x3e7, 0x29fb(%rip) # imm = 0x3E7
jae 0x16d4
movq 0x29f2(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x29e7(%rip)      # 0x40a8
leaq 0x9e0(%rip), %rdi       # 0x20a8
movb $0x0, %al
callq 0x1070
jmp 0x1756
cmpq $0x270f, 0x29c9(%rip) # imm = 0x270F
jae 0x1703
movq 0x29c0(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x29b5(%rip)      # 0x40a8
leaq 0x9af(%rip), %rdi       # 0x20a9
movb $0x0, %al
callq 0x1070
jmp 0x1754
cmpq $0x1869f, 0x299a(%rip) # imm = 0x1869F
jae 0x1732
movq 0x2991(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x2986(%rip)      # 0x40a8
leaq 0x981(%rip), %rdi       # 0x20aa
movb $0x0, %al
callq 0x1070
jmp 0x1752
movq 0x296f(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x2964(%rip)      # 0x40a8
leaq 0x960(%rip), %rdi       # 0x20ab
movb $0x0, %al
callq 0x1070
jmp 0x1754
jmp 0x1756
jmp 0x1758
jmp 0x175a
jmp 0x175c
jmp 0x175e
cmpl $0x0, -0x2c(%rbp)
je 0x1987
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x196e
movq -0x10(%rbp), %rax
testb $0x1, 0x2(%rax)
je 0x17aa
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x17aa
movq 0x283b(%rip), %rax      # 0x3fd8
movq (%rax), %rsi
movl $0x24, %edi
callq 0x10a0
movq -0x10(%rbp), %rax
testb $0x1, 0x5(%rax)
je 0x17e0
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x17e0
movq 0x280c(%rip), %rax      # 0x3fd8
movq (%rax), %rsi
leaq 0x8db(%rip), %rdi       # 0x20b1
callq 0x1080
jmp 0x1960
movq -0x10(%rbp), %rax
testb $0x1, 0x3(%rax)
je 0x1945
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x1945
movl -0x30(%rbp), %eax
addl $0x1, %eax
cmpl -0x2c(%rbp), %eax
jge 0x1945
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %edi
movq 0x27b3(%rip), %rax      # 0x3fd8
movq (%rax), %rsi
callq 0x10a0
cmpq $0x9, 0x2873(%rip)      # 0x40a8
jae 0x185c
movq 0x286a(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x285f(%rip)      # 0x40a8
leaq 0x856(%rip), %rdi       # 0x20a6
movb $0x0, %al
callq 0x1070
jmp 0x1943
cmpq $0x63, 0x2844(%rip)     # 0x40a8
jae 0x188b
movq 0x283b(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x2830(%rip)      # 0x40a8
leaq 0x828(%rip), %rdi       # 0x20a7
movb $0x0, %al
callq 0x1070
jmp 0x1941
cmpq $0x3e7, 0x2812(%rip) # imm = 0x3E7
jae 0x18bd
movq 0x2809(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x27fe(%rip)      # 0x40a8
leaq 0x7f7(%rip), %rdi       # 0x20a8
movb $0x0, %al
callq 0x1070
jmp 0x193f
cmpq $0x270f, 0x27e0(%rip) # imm = 0x270F
jae 0x18ec
movq 0x27d7(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x27cc(%rip)      # 0x40a8
leaq 0x7c6(%rip), %rdi       # 0x20a9
movb $0x0, %al
callq 0x1070
jmp 0x193d
cmpq $0x1869f, 0x27b1(%rip) # imm = 0x1869F
jae 0x191b
movq 0x27a8(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x279d(%rip)      # 0x40a8
leaq 0x798(%rip), %rdi       # 0x20aa
movb $0x0, %al
callq 0x1070
jmp 0x193b
movq 0x2786(%rip), %rsi      # 0x40a8
addq $0x1, %rsi
movq %rsi, 0x277b(%rip)      # 0x40a8
leaq 0x777(%rip), %rdi       # 0x20ab
movb $0x0, %al
callq 0x1070
jmp 0x193d
jmp 0x193f
jmp 0x1941
jmp 0x1943
jmp 0x1960
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %edi
movq 0x2680(%rip), %rax      # 0x3fd8
movq (%rax), %rsi
callq 0x10a0
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x176f
movl -0x4(%rbp), %edi
movq -0x28(%rbp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x10b0
movl %eax, -0x2c(%rbp)
jmp 0x175e
movq -0x28(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)