// File: mattn[P]wandbox-run/wandbox.cxx
// Function: languages()
static int
languages() {
  CURLcode ret;
  CURL *curl = curl_easy_init();
  if (curl == NULL) {
    std::cerr << "curl_easy_init() failed" << std::endl;
    return 1;
  }

  std::string chunk;
  curl_easy_setopt(curl, CURLOPT_URL, "https://wandbox.org/api/list.json");
  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
  curl_easy_setopt(curl, CURLOPT_WRITEDATA, &chunk);
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);

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

  nlohmann::json list = nlohmann::json::parse(chunk);
  for (auto& element : list) {
    std::cerr << "  " << element["name"].get<std::string>() << std::endl;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
callq 0x13670
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x16a19
leaq 0x1059ae(%rip), %rdi    # 0x11c3a0
leaq 0xbdbb6(%rip), %rsi     # 0xd45af
callq 0x920f0
movq %rax, %rdi
leaq 0x7afc8(%rip), %rsi     # 0x919d0
callq 0x90be0
movl $0x1, -0x4(%rbp)
jmp 0x16cd9
leaq -0x30(%rbp), %rdi
callq 0xa22c0
movq -0x10(%rbp), %rdi
leaq 0xbdb9a(%rip), %rdx     # 0xd45c7
xorl %eax, %eax
movl $0x2712, %esi           # imm = 0x2712
callq 0x135c0
jmp 0x16a3b
movq -0x10(%rbp), %rdi
leaq 0x8ca(%rip), %rdx       # 0x17310
xorl %eax, %eax
movl $0x4e2b, %esi           # imm = 0x4E2B
callq 0x135c0
jmp 0x16a54
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl $0x2711, %esi           # imm = 0x2711
leaq -0x30(%rbp), %rdx
callq 0x135c0
jmp 0x16a6a
movq -0x10(%rbp), %rdi
callq 0x13470
movl %eax, -0xe4(%rbp)
jmp 0x16a7b
movl -0xe4(%rbp), %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x130f0
jmp 0x16a8f
cmpl $0x0, -0x8(%rbp)
je 0x16b1b
leaq 0x105900(%rip), %rdi    # 0x11c3a0
leaq 0xbdb42(%rip), %rsi     # 0xd45e9
callq 0x920f0
movq %rax, -0xf0(%rbp)
jmp 0x16ab5
movl -0x8(%rbp), %edi
callq 0x13310
movq %rax, -0xf8(%rbp)
jmp 0x16ac6
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rdi
callq 0x920f0
movq %rax, -0x100(%rbp)
jmp 0x16ae2
movq -0x100(%rbp), %rdi
leaq 0x7aee0(%rip), %rsi     # 0x919d0
callq 0x90be0
jmp 0x16af7
movl $0x1, -0x4(%rbp)
movl $0x1, -0x40(%rbp)
jmp 0x16cc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x16cce
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x179a0
movq -0x108(%rbp), %rdx
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x17900
jmp 0x16b45
leaq -0x70(%rbp), %rdi
callq 0x179e0
leaq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x17a00
movq -0x78(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x17a40
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x17a80
movb %al, -0x109(%rbp)
jmp 0x16b91
movb -0x109(%rbp), %al
testb $0x1, %al
jne 0x16ba0
jmp 0x16c9f
leaq -0x98(%rbp), %rdi
callq 0x17ab0
movq %rax, -0x118(%rbp)
jmp 0x16bb5
movq -0x118(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq 0x1057d6(%rip), %rdi    # 0x11c3a0
leaq 0xc092e(%rip), %rsi     # 0xd74ff
callq 0x920f0
movq %rax, -0x120(%rbp)
jmp 0x16bdf
movq -0xc0(%rbp), %rdi
leaq 0xbda19(%rip), %rsi     # 0xd4606
callq 0x17540
movq %rax, -0x128(%rbp)
jmp 0x16bfb
movq -0x128(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x17cd0
jmp 0x16c10
movq -0x120(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xa4e00
movq %rax, -0x130(%rbp)
jmp 0x16c2c
movq -0x130(%rbp), %rdi
leaq 0x7ad96(%rip), %rsi     # 0x919d0
callq 0x90be0
jmp 0x16c41
leaq -0xe0(%rbp), %rdi
callq 0xa23d0
leaq -0x98(%rbp), %rdi
callq 0x17d50
jmp 0x16c5b
jmp 0x16b76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x179e0
jmp 0x16cce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x16cb8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0xa23d0
jmp 0x16cb8
movl $0x0, -0x4(%rbp)
movl $0x1, -0x40(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x177b0
jmp 0x16cc3
leaq -0x50(%rbp), %rdi
callq 0x177b0
jmp 0x16cce
leaq -0x30(%rbp), %rdi
callq 0xa23d0
jmp 0x16cd9
leaq -0x30(%rbp), %rdi
callq 0xa23d0
jmp 0x16ce5
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0xd1250
nop