// File: mattn[P]wandbox-run/wandbox.cxx
// Function: run(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&)
static int
run(nlohmann::json& obj) {
  std::stringstream ss;

  CURLcode ret;
  CURL *curl = curl_easy_init();
  if (curl == NULL) {
    std::cerr << "curl_easy_init() failed" << std::endl;
    return 1;
  }
  ss << obj;
  std::string data = ss.str();

  struct curl_slist *headerlist = NULL;
  headerlist = curl_slist_append(headerlist, "Content-Type: application/json");

  std::string chunk;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
  curl_easy_setopt(curl, CURLOPT_URL, "https://wandbox.org/api/compile.json");
  curl_easy_setopt(curl, CURLOPT_POST, 1);
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str());
  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
  curl_easy_setopt(curl, CURLOPT_WRITEDATA, &chunk);
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
  curl_slist_free_all(headerlist);

  if (ret != CURLE_OK) {
    std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(ret) << std::endl;
    return 1;
  }

  obj = nlohmann::json::parse(chunk);
  try {
    std::cout << obj["program_message"].get<std::string>();
  } catch(std::exception& e) {
    std::cerr << obj["compiler_message"].get<std::string>() << std::endl;
  }

  int code;
  reset_stream(ss);
  ss << obj["status"];
  ss >> code;
  return code;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rdi, -0x10(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x9b640
callq 0x13670
movq %rax, -0x2b0(%rbp)
jmp 0x16d19
movq -0x2b0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
cmpq $0x0, -0x1a8(%rbp)
jne 0x16d8f
leaq 0x105668(%rip), %rdi    # 0x11c3a0
leaq 0xbd870(%rip), %rsi     # 0xd45af
callq 0x920f0
movq %rax, -0x2b8(%rbp)
jmp 0x16d4d
movq -0x2b8(%rbp), %rdi
leaq 0x7ac75(%rip), %rsi     # 0x919d0
callq 0x90be0
jmp 0x16d62
movl $0x1, -0x4(%rbp)
movl $0x1, -0x1b8(%rbp)
jmp 0x172d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x172eb
leaq -0x188(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x22100
jmp 0x16da1
leaq -0x1d8(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x9c610
jmp 0x16db6
movq $0x0, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rdi
leaq 0xbfb00(%rip), %rsi     # 0xd68cf
callq 0x13460
movq %rax, -0x2c0(%rbp)
jmp 0x16ddd
movq -0x2c0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0x200(%rbp), %rdi
callq 0xa22c0
movq -0x1a8(%rbp), %rdi
movq -0x1e0(%rbp), %rdx
xorl %eax, %eax
movl $0x2727, %esi           # imm = 0x2727
callq 0x135c0
jmp 0x16e13
movq -0x1a8(%rbp), %rdi
leaq 0xbfacd(%rip), %rdx     # 0xd68ee
xorl %eax, %eax
movl $0x2712, %esi           # imm = 0x2712
callq 0x135c0
jmp 0x16e2f
movq -0x1a8(%rbp), %rdi
xorl %eax, %eax
movl $0x2f, %esi
movl $0x1, %edx
callq 0x135c0
jmp 0x16e49
movq -0x1a8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0xa3e10
movq -0x2c8(%rbp), %rdi
movq %rax, %rdx
xorl %eax, %eax
movl $0x271f, %esi           # imm = 0x271F
callq 0x135c0
jmp 0x16e7b
movq -0x1a8(%rbp), %rdi
leaq 0x487(%rip), %rdx       # 0x17310
xorl %eax, %eax
movl $0x4e2b, %esi           # imm = 0x4E2B
callq 0x135c0
jmp 0x16e97
movq -0x1a8(%rbp), %rdi
xorl %eax, %eax
movl $0x2711, %esi           # imm = 0x2711
leaq -0x200(%rbp), %rdx
callq 0x135c0
jmp 0x16eb3
movq -0x1a8(%rbp), %rdi
callq 0x13470
movl %eax, -0x2cc(%rbp)
jmp 0x16ec7
movl -0x2cc(%rbp), %eax
movl %eax, -0x19c(%rbp)
movq -0x1a8(%rbp), %rdi
callq 0x130f0
jmp 0x16ee1
movq -0x1e0(%rbp), %rdi
callq 0x13610
jmp 0x16eef
cmpl $0x0, -0x19c(%rbp)
je 0x16fa1
leaq 0x10549d(%rip), %rdi    # 0x11c3a0
leaq 0xbd6df(%rip), %rsi     # 0xd45e9
callq 0x920f0
movq %rax, -0x2d8(%rbp)
jmp 0x16f18
movl -0x19c(%rbp), %edi
callq 0x13310
movq %rax, -0x2e0(%rbp)
jmp 0x16f2c
movq -0x2e0(%rbp), %rsi
movq -0x2d8(%rbp), %rdi
callq 0x920f0
movq %rax, -0x2e8(%rbp)
jmp 0x16f48
movq -0x2e8(%rbp), %rdi
leaq 0x7aa7a(%rip), %rsi     # 0x919d0
callq 0x90be0
jmp 0x16f5d
movl $0x1, -0x4(%rbp)
movl $0x1, -0x1b8(%rbp)
jmp 0x1729f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x172c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x172b9
xorl %eax, %eax
movl %eax, %esi
leaq -0x230(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x179a0
movq -0x2f0(%rbp), %rdx
leaq -0x210(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x17900
jmp 0x16fd4
movq -0x10(%rbp), %rdi
leaq -0x210(%rbp), %rsi
movq %rsi, -0x300(%rbp)
callq 0x17740
movq -0x300(%rbp), %rdi
callq 0x177b0
leaq -0x230(%rbp), %rdi
callq 0x179e0
movq -0x10(%rbp), %rdi
leaq 0xbf905(%rip), %rsi     # 0xd6913
callq 0x17540
movq %rax, -0x2f8(%rbp)
jmp 0x1701c
movq -0x2f8(%rbp), %rsi
leaq -0x250(%rbp), %rdi
callq 0x17cd0
jmp 0x17031
leaq 0x105488(%rip), %rdi    # 0x11c4c0
leaq -0x250(%rbp), %rsi
callq 0xa4e00
jmp 0x17046
leaq -0x250(%rbp), %rdi
callq 0xa23d0
jmp 0x17146
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x179e0
jmp 0x172b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x170ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x250(%rbp), %rdi
callq 0xa23d0
movl -0x1b4(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x172b9
movq -0x1b0(%rbp), %rdi
callq 0x258a0
movq %rax, -0x258(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xbf846(%rip), %rsi     # 0xd6923
callq 0x17540
movq %rax, -0x308(%rbp)
jmp 0x170eb
movq -0x308(%rbp), %rsi
leaq -0x278(%rbp), %rdi
callq 0x17cd0
jmp 0x17100
leaq 0x105299(%rip), %rdi    # 0x11c3a0
leaq -0x278(%rbp), %rsi
callq 0xa4e00
movq %rax, -0x310(%rbp)
jmp 0x1711c
movq -0x310(%rbp), %rdi
leaq 0x7a8a6(%rip), %rsi     # 0x919d0
callq 0x90be0
jmp 0x17131
leaq -0x278(%rbp), %rdi
callq 0xa23d0
callq 0x25910
jmp 0x17144
jmp 0x17146
leaq -0x2a1(%rbp), %rdi
movq %rdi, -0x318(%rbp)
callq 0x26cc0
movq -0x318(%rbp), %rdx
leaq 0xbe528(%rip), %rsi     # 0xd568f
leaq -0x2a0(%rbp), %rdi
callq 0x17380
jmp 0x17175
leaq -0x198(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x9c6a0
jmp 0x1718a
leaq -0x2a0(%rbp), %rdi
callq 0xa23d0
leaq -0x2a1(%rbp), %rdi
callq 0x26ce0
movq -0x198(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x198(%rbp,%rax), %rdi
xorl %esi, %esi
callq 0x72a40
jmp 0x171be
leaq -0x188(%rbp), %rax
movq %rax, -0x328(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xbf75d(%rip), %rsi     # 0xd6934
callq 0x17540
movq %rax, -0x320(%rbp)
jmp 0x171e5
movq -0x320(%rbp), %rsi
movq -0x328(%rbp), %rdi
callq 0x22100
jmp 0x171fa
leaq -0x198(%rbp), %rdi
leaq -0x27c(%rbp), %rsi
callq 0x762c0
jmp 0x1720f
movl -0x27c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x1b8(%rbp)
jmp 0x1729f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x17256
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x278(%rbp), %rdi
callq 0xa23d0
callq 0x25910
jmp 0x1725d
jmp 0x172b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x17291
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0xa23d0
leaq -0x2a1(%rbp), %rdi
callq 0x26ce0
jmp 0x172b9
leaq -0x200(%rbp), %rdi
callq 0xa23d0
leaq -0x1d8(%rbp), %rdi
callq 0xa23d0
jmp 0x172d3
leaq -0x200(%rbp), %rdi
callq 0xa23d0
leaq -0x1d8(%rbp), %rdi
callq 0xa23d0
jmp 0x172eb
leaq -0x198(%rbp), %rdi
callq 0x97a60
movl -0x4(%rbp), %eax
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
leaq -0x198(%rbp), %rdi
callq 0x97a60
movq -0x1b0(%rbp), %rdi
callq 0xd1250
movq %rax, %rdi
callq 0x1afe0
nopl (%rax,%rax)