// File: /workspace/github_c_makefile_star2_O0/seojangho[P]clee/interpose.c
// Function: main
int main(int argc, char **argv, char **envp) {
    int param_opt;
    _Bool seccomp_enabled = false;
    while ((param_opt = getopt(argc, argv, "abcoqh")) != -1) {
        switch (param_opt) {
            case 'a':
                option_write_stdout = true;
                break;
            case 'b':
                option_nullify_stdout = true;
                break;
            case 'c':
                option_write2read = true;
                break;
            case 'q':
                option_print_syscall = false;
                break;
            case 'o':
                seccomp_enabled = true;
                break;
            case 'h':
                showhelp(argv[0]);
                exit(0);
            case '?':
                showhelp(argv[0]);
                exit(1);
        }
    }
    struct sock_filter filter[] = {
        BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, nr))),
        BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_open, 1, 0),
        BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
        BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL),
    };

    if (optind == argc) {
        showhelp(argv[0]);
        exit(1);
    }

    clee_init();
    clee_set_trigger(exited, onExit);
    clee_set_trigger(syscall_entry, onSyscallEntry);
    clee_set_trigger(syscall_exit, onSyscallExit);
    clee_set_trigger(new_process, onNew);
    clee(argv[optind], argv + optind, envp, next_syscall, seccomp_enabled ? filter : NULL, 4);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x1d(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x193e(%rip), %rdx      # 0x8faa
callq 0x31d0
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0x76f6
movl -0x1c(%rbp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x32, %eax
ja 0x76f1
movq -0x48(%rbp), %rax
leaq 0x17fb(%rip), %rcx      # 0x8e90
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, 0x4c6c(%rip)      # 0xc311
jmp 0x76f1
movb $0x1, 0x4c64(%rip)      # 0xc312
jmp 0x76f1
movb $0x1, 0x4c59(%rip)      # 0xc310
jmp 0x76f1
movb $0x0, 0x4a68(%rip)      # 0xc128
jmp 0x76f1
movb $0x1, -0x1d(%rbp)
jmp 0x76f1
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x7810
xorl %edi, %edi
callq 0x31f0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x7810
movl $0x1, %edi
callq 0x31f0
jmp 0x765e
movq 0x1a13(%rip), %rax      # 0x9110
movq %rax, -0x40(%rbp)
movq 0x1a10(%rip), %rax      # 0x9118
movq %rax, -0x38(%rbp)
movq 0x1a0d(%rip), %rax      # 0x9120
movq %rax, -0x30(%rbp)
movq 0x1a0a(%rip), %rax      # 0x9128
movq %rax, -0x28(%rbp)
movq 0x48af(%rip), %rax      # 0xbfd8
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jne 0x7746
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x7810
movl $0x1, %edi
callq 0x31f0
movb $0x0, %al
callq 0x3330
movl $0x2, %edi
leaq -0x159(%rip), %rsi      # 0x7600
callq 0x3d80
xorl %edi, %edi
leaq -0x2a7(%rip), %rsi      # 0x74c0
callq 0x3d80
movl $0x1, %edi
leaq -0x1c8(%rip), %rsi      # 0x75b0
callq 0x3d80
movl $0x6, %edi
leaq -0x1f9(%rip), %rsi      # 0x7590
callq 0x3d80
movq -0x10(%rbp), %rax
movq 0x483f(%rip), %rcx      # 0xbfd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x4829(%rip), %rcx      # 0xbfd8
movslq (%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
testb $0x1, -0x1d(%rbp)
je 0x77d5
leaq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x77dd
xorl %eax, %eax
movq %rax, -0x68(%rbp)
jmp 0x77dd
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %r8
movl $0x4, %r9d
movl %r9d, %ecx
callq 0x3410
xorl %eax, %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)