// File: /workspace/github_c_makefile_star2_O0/starius[P]dna-complement/dna-complement-int.c
// Function: main
int main(int argc, char** argv) {
    if (argc < 1 + 3) {
        fprintf(stderr, "Usage: %s table16g input output\n", argv[0]);
        return 1;
    }
    const char* table16g_fname = argv[1];
    int table16g_fd = open(table16g_fname, O_RDONLY);
    size_t table16g_size =
        (size_t)(256*256) * (size_t)(256*256) * sizeof(int);
    unsigned int* int_translate = mmap(
            0, // target address
            table16g_size, // size
            PROT_READ, // protection
            MAP_PRIVATE, // flags
            table16g_fd, // file descriptor
            0 // offset
            );
    if (!int_translate) {
        fprintf(stderr, "Can't mmap table16g\n");
        return 1;
    }
    const char* input_fname = argv[2];
    const char* output_fname = argv[3];
    FILE* input = fopen(input_fname, "rb");
    if (!input) {
        fprintf(stderr, "Can't open %s: %s\n",
                input_fname, strerror(errno));
        return 1;
    }
    FILE* output = fopen(output_fname, "wb");
    if (!output) {
        fprintf(stderr, "Can't open %s: %s\n",
                output_fname, strerror(errno));
        return 1;
    }
    char input_buffer[BUFSIZE];
    int* input_it;
    int* input_buffer_end = (int*)(input_buffer + BUFSIZE);
#ifdef SAME_BUFFER
# define output_buffer input_buffer
# define output_it input_it
#else
    char output_buffer[BUFSIZE];
    int* output_it;
#endif
    size_t nread;
    while (nread = fread(input_buffer, 1, BUFSIZE, input)) {
        for (input_it = (unsigned int*)input_buffer
#ifndef SAME_BUFFER
             , output_it = (unsigned int*)output_buffer
#endif
             ; input_it < input_buffer_end; input_it++
#ifndef SAME_BUFFER
             , output_it++
#endif
             )
        {
            *output_it = int_translate[*input_it];
        }
        fwrite(output_buffer, 1, nread, output);
    }
    fclose(input);
    fclose(output);
    munmap(int_translate, table16g_size);
    return 0;
}

// Assembly:
subq $0x200098, %rsp         # imm = 0x200098
movl $0x0, 0x200094(%rsp)
movl %edi, 0x200090(%rsp)
movq %rsi, 0x200088(%rsp)
cmpl $0x4, 0x200090(%rsp)
jge 0x122e
movq 0x2df6(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq 0x200088(%rsp), %rax
movq (%rax), %rdx
leaq 0xded(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x1070
movl $0x1, 0x200094(%rsp)
jmp 0x14f4
movq 0x200088(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x200080(%rsp)
movq 0x200080(%rsp), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x1090
movl %eax, 0x20007c(%rsp)
movabsq $0x400000000, %rax      # imm = 0x400000000
movq %rax, 0x200070(%rsp)
movq 0x200070(%rsp), %rsi
movl 0x20007c(%rsp), %r8d
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, %edx
movl $0x2, %ecx
movq %r9, %rdi
callq 0x1060
movq %rax, 0x200068(%rsp)
cmpq $0x0, 0x200068(%rsp)
jne 0x12ce
movq 0x2d4b(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xd6e(%rip), %rsi       # 0x2025
movb $0x0, %al
callq 0x1070
movl $0x1, 0x200094(%rsp)
jmp 0x14f4
movq 0x200088(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x200060(%rsp)
movq 0x200088(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x200058(%rsp)
movq 0x200060(%rsp), %rdi
leaq 0xd35(%rip), %rsi       # 0x203a
callq 0x10a0
movq %rax, 0x200050(%rsp)
cmpq $0x0, 0x200050(%rsp)
jne 0x1370
movq 0x2cd4(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x200060(%rsp), %rax
movq %rax, 0x18(%rsp)
callq 0x1030
movl (%rax), %edi
callq 0x10c0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rdx
movq %rax, %rcx
leaq 0xce4(%rip), %rsi       # 0x203d
movb $0x0, %al
callq 0x1070
movl $0x1, 0x200094(%rsp)
jmp 0x14f4
movq 0x200058(%rsp), %rdi
leaq 0xcd1(%rip), %rsi       # 0x2050
callq 0x10a0
movq %rax, 0x200048(%rsp)
cmpq $0x0, 0x200048(%rsp)
jne 0x13e8
movq 0x2c5a(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x200058(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x1030
movl (%rax), %edi
callq 0x10c0
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
movq %rax, %rcx
leaq 0xc6c(%rip), %rsi       # 0x203d
movb $0x0, %al
callq 0x1070
movl $0x1, 0x200094(%rsp)
jmp 0x14f4
leaq 0x100040(%rsp), %rax
addq $0x100000, %rax         # imm = 0x100000
movq %rax, 0x100030(%rsp)
leaq 0x100040(%rsp), %rdi
movq 0x200050(%rsp), %rcx
movl $0x1, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x1040
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x14ba
leaq 0x100040(%rsp), %rax
movq %rax, 0x100038(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x100038(%rsp), %rax
cmpq 0x100030(%rsp), %rax
jae 0x1499
movq 0x200068(%rsp), %rax
movq 0x100038(%rsp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movq 0x100038(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x100038(%rsp)
movq 0x28(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x28(%rsp)
jmp 0x1446
leaq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rdx
movq 0x200048(%rsp), %rcx
movl $0x1, %esi
callq 0x10b0
jmp 0x13fe
movq 0x200050(%rsp), %rdi
callq 0x1050
movq 0x200048(%rsp), %rdi
callq 0x1050
movq 0x200068(%rsp), %rdi
movq 0x200070(%rsp), %rsi
callq 0x1080
movl $0x0, 0x200094(%rsp)
movl 0x200094(%rsp), %eax
addq $0x200098, %rsp         # imm = 0x200098
retq