// File: epfml[P]Bi-Sent2Vec/src/main.cc
// Function: predict(int, char**)
void predict(int argc, char** argv) {
  if (argc < 4 || argc > 5) {
    printPredictUsage();
    exit(EXIT_FAILURE);
  }
  int32_t k = 1;
  if (argc >= 5) {
    k = atoi(argv[4]);
  }

  bool print_prob = std::string(argv[1]) == "predict-prob";
  FastText fasttext;
  fasttext.loadModel(std::string(argv[2]));

  std::string infile(argv[3]);
  if (infile == "-") {
    fasttext.predict(std::cin, k, print_prob);
  } else {
    std::ifstream ifs(infile);
    if (!ifs.is_open()) {
      std::cerr << "Input file cannot be opened!" << std::endl;
      exit(EXIT_FAILURE);
    }
    fasttext.predict(ifs, k, print_prob);
    ifs.close();
  }

  exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x380, %rsp            # imm = 0x380
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x4, -0x4(%rbp)
jl 0x4011e
cmpl $0x5, -0x4(%rbp)
jle 0x4012d
callq 0x3f9d0
movl $0x1, %edi
callq 0x54f0
movl $0x1, -0x14(%rbp)
cmpl $0x5, -0x4(%rbp)
jl 0x4014a
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x5680
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x340(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x57b0
movq -0x340(%rbp), %rsi
movq -0x338(%rbp), %rdx
leaq -0x38(%rbp), %rdi
callq 0x7c10
jmp 0x40182
leaq 0x44b0(%rip), %rsi      # 0x44639
leaq -0x38(%rbp), %rdi
callq 0x7cc0
movb %al, -0x341(%rbp)
jmp 0x4019a
leaq -0x38(%rbp), %rdi
callq 0x58d8
leaq -0x39(%rbp), %rdi
callq 0x5480
movb -0x341(%rbp), %al
andb $0x1, %al
movb %al, -0x15(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x27dc0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x358(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x57b0
movq -0x358(%rbp), %rsi
movq -0x350(%rbp), %rdx
leaq -0xf8(%rbp), %rdi
callq 0x7c10
jmp 0x40201
leaq -0xd8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x295b0
jmp 0x4021d
leaq -0xf8(%rbp), %rdi
callq 0x58d8
leaq -0xf9(%rbp), %rdi
callq 0x5480
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x368(%rbp)
leaq -0x121(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x57b0
movq -0x368(%rbp), %rsi
movq -0x360(%rbp), %rdx
leaq -0x120(%rbp), %rdi
callq 0x7c10
jmp 0x40273
leaq -0x121(%rbp), %rdi
callq 0x5480
leaq 0x36d2(%rip), %rsi      # 0x43958
leaq -0x120(%rbp), %rdi
callq 0x7cc0
movb %al, -0x369(%rbp)
jmp 0x4029a
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x402a9
jmp 0x40363
movl -0x14(%rbp), %edx
movzbl -0x15(%rbp), %ecx
andl $0x1, %ecx
movq 0x1ed1e(%rip), %rsi     # 0x5efd8
leaq -0xd8(%rbp), %rdi
callq 0x2c600
jmp 0x402c8
jmp 0x4042b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x402f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x58d8
leaq -0x39(%rbp), %rdi
callq 0x5480
jmp 0x4044a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x40324
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x58d8
leaq -0xf9(%rbp), %rdi
callq 0x5480
jmp 0x4043e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x121(%rbp), %rdi
callq 0x5480
jmp 0x4043e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x40432
leaq -0x330(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movl $0x8, %edx
callq 0x56d0
jmp 0x4037d
leaq -0x330(%rbp), %rdi
callq 0x56c0
movb %al, -0x36a(%rbp)
jmp 0x40391
movb -0x36a(%rbp), %al
testb $0x1, %al
jne 0x403f2
jmp 0x4039d
movq 0x1ec4c(%rip), %rdi     # 0x5eff0
leaq 0x35ce(%rip), %rsi      # 0x43979
callq 0x5420
movq %rax, -0x378(%rbp)
jmp 0x403b9
movq -0x378(%rbp), %rdi
movq 0x1ebc9(%rip), %rsi     # 0x5ef90
callq 0x5460
jmp 0x403ce
movl $0x1, %edi
callq 0x54f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x5130
jmp 0x40432
movl -0x14(%rbp), %edx
movzbl -0x15(%rbp), %ecx
andl $0x1, %ecx
leaq -0xd8(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x2c600
jmp 0x40411
leaq -0x330(%rbp), %rdi
callq 0x50f0
jmp 0x4041f
leaq -0x330(%rbp), %rdi
callq 0x5130
xorl %edi, %edi
callq 0x54f0
leaq -0x120(%rbp), %rdi
callq 0x58d8
leaq -0xd8(%rbp), %rdi
callq 0x41a10
movq -0x48(%rbp), %rdi
callq 0x57a0
nopw %cs:(%rax,%rax)