#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ getint(int *);
int /*<<< orphan*/ nameitem(char *, int);
int numslav(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ removeslave(int *, int);
int /*<<< orphan*/ treasure(int *, int *, int *, int *, int *, int *, int *,
                            int *, int *, int *, int *, int *,
                            int /*<<< orphan*/, int, int /*<<< orphan*/);
int valueitem(int);
void goodsoffer(int *hpmax, int *hpnow, int *aces, int *inv, int *slave,
                int *future, int *map, int *loot, int *vision, int *end,
                int *pos, int *antimag) {
  int value = 0;
  int k;
  int offitem[10];
  for (k = 0; k < 10; k++) {
    offitem[k] = 0;
  }
  int offslav;
  char s[20];
  int p = -1;
  do {
    printf("'What do you want to offer? An item or a slave?'\n[0]: Item\n[1]: "
           "Slave\n");
    getint(&k);
    if (k == 0) {
      printf("'What item do you want to offer?'\n");
      getint(&k);
      if ((k < 0) || (k >= 10) || (*(inv + k) == 0)) {
        printf("'Are you kidding me? Do you want to abort the trade?'\n[0]: "
               "No\n[1]: Yes\n");
        getint(&k);
        if (k == 1) {
          printf("You aborted the trade.\n");
          return;
        }
      } else {
        value += valueitem(*(inv + k));
        p++;
        offitem[p] = *(inv + k);
      }
    } else if (k == 1) {
      if (offslav >= numslav(slave)) {
        printf("'You don't have enough slaves to offer!\n'");
      } else {
        offslav++;
        value += 8;
      }
    } else {
      printf("'Are you kidding me? Do you want to abort the trade?'\n[0]: "
             "No\n[1]: Yes\n");
      getint(&k);
      if (k == 1) {
        printf("You aborted the trade.\n");
        return;
      }
    }
    if (value < valueitem(*(loot + *pos)))
      printf("'My item is valued %d gems and you offer is worth %d gems.'\n",
             valueitem(*(loot + *pos)), value);
    else {
      printf("'I'm satisfied with your offer of %d slaves and", offslav);
      for (k = 0; k <= p; k++) {
        nameitem(s, offitem[k]);
        printf(" %s", s);
        if (k < p) {
          printf(",");
        } else {
          printf(".");
        }
      }
      if (p < 0) {
        printf("nothing else.'\n");
      } else {
        printf(".'\n");
      }
      k = -1;
      do {
        printf("'Do you accept the trade?'\n[0]: No\n[1]: Yes\n");
        getint(&k);
        if (k == 0) {
          printf("'Do you want to abort the trade?'\n[0]: No\n[1]: Yes\n");
          getint(&k);
          if (k == 1) {
            printf("You aborted the trade.\n");
            return;
          }
          printf(
              "'Do you want to propose another offer?'\n[0]: No\n[1]: Yes\n");
          if (k == 0) {
            printf("You aborted the trade.\n");
            return;
          }
          for (k = 0; k < 10; k++) {
            offitem[k] = 0;
          }
          offslav = 0;
          p = -1;
        } else if (k == 1) {
          removeslave(slave, offslav);
          for (k = 0; k <= p; k++) {
            *(inv + offitem[k]) = 0;
          }
          treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision,
                   end, pos, antimag, 0, 1, 0);
        }
      } while (k < 0);
    }
  } while (value < valueitem(*(loot + *pos)));
}


x86 assembly (clang, -O0):
<goodsoffer>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe0,%rsp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %r8,-0x48(%rbp)
mov    %r9,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0xa,-0x58(%rbp)
jge    11e4 <goodsoffer+0x74>
movslq -0x58(%rbp),%rax
movl   $0x0,-0x80(%rbp,%rax,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11c0 <goodsoffer+0x50>
movl   $0xffffffff,-0xa4(%rbp)
ff ff ff
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x58(%rbp),%rdi
call   1050 <getint@plt>
cmpl   $0x0,-0x58(%rbp)
jne    12c5 <goodsoffer+0x155>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x58(%rbp),%rdi
call   1050 <getint@plt>
cmpl   $0x0,-0x58(%rbp)
jl     124c <goodsoffer+0xdc>
cmpl   $0xa,-0x58(%rbp)
jge    124c <goodsoffer+0xdc>
mov    -0x40(%rbp),%rax
movslq -0x58(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1285 <goodsoffer+0x115>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x58(%rbp),%rdi
call   1050 <getint@plt>
cmpl   $0x1,-0x58(%rbp)
jne    1280 <goodsoffer+0x110>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1650 <goodsoffer+0x4e0>
jmp    12c0 <goodsoffer+0x150>
mov    -0x40(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1090 <valueitem@plt>
add    -0x54(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0xa4(%rbp),%rax
mov    %ecx,-0x80(%rbp,%rax,4)
jmp    1362 <goodsoffer+0x1f2>
cmpl   $0x1,-0x58(%rbp)
jne    1324 <goodsoffer+0x1b4>
mov    -0x84(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x48(%rbp),%rdi
call   1070 <numslav@plt>
mov    %eax,%ecx
mov    -0xa8(%rbp),%eax
cmp    %ecx,%eax
jl     1307 <goodsoffer+0x197>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    131f <goodsoffer+0x1af>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x54(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x54(%rbp)
jmp    135d <goodsoffer+0x1ed>
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x58(%rbp),%rdi
call   1050 <getint@plt>
cmpl   $0x1,-0x58(%rbp)
jne    1358 <goodsoffer+0x1e8>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1650 <goodsoffer+0x4e0>
jmp    135d <goodsoffer+0x1ed>
jmp    1362 <goodsoffer+0x1f2>
mov    -0x54(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    0x18(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,4),%edi
call   1090 <valueitem@plt>
mov    %eax,%ecx
mov    -0xac(%rbp),%eax
cmp    %ecx,%eax
jge    13b9 <goodsoffer+0x249>
mov    0x18(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,4),%edi
call   1090 <valueitem@plt>
mov    %eax,%esi
mov    -0x54(%rbp),%edx
lea    0xd47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    161f <goodsoffer+0x4af>
mov    -0x84(%rbp),%esi
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jg     144f <goodsoffer+0x2df>
lea    -0xa0(%rbp),%rdi
movslq -0x58(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%esi
call   1060 <nameitem@plt>
lea    -0xa0(%rbp),%rsi
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x58(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jge    142e <goodsoffer+0x2be>
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    143c <goodsoffer+0x2cc>
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1441 <goodsoffer+0x2d1>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    13d4 <goodsoffer+0x264>
cmpl   $0x0,-0xa4(%rbp)
jge    146f <goodsoffer+0x2ff>
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    147d <goodsoffer+0x30d>
lea    0xcff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x58(%rbp)
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x58(%rbp),%rdi
call   1050 <getint@plt>
cmpl   $0x0,-0x58(%rbp)
jne    1548 <goodsoffer+0x3d8>
lea    0xcfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x58(%rbp),%rdi
call   1050 <getint@plt>
cmpl   $0x1,-0x58(%rbp)
jne    14d9 <goodsoffer+0x369>
lea    0xbe5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1650 <goodsoffer+0x4e0>
lea    0xcfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x58(%rbp)
jne    1504 <goodsoffer+0x394>
lea    0xbba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1650 <goodsoffer+0x4e0>
movl   $0x0,-0x58(%rbp)
cmpl   $0xa,-0x58(%rbp)
jge    152f <goodsoffer+0x3bf>
movslq -0x58(%rbp),%rax
movl   $0x0,-0x80(%rbp,%rax,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    150b <goodsoffer+0x39b>
movl   $0x0,-0x84(%rbp)
movl   $0xffffffff,-0xa4(%rbp)
ff ff ff
jmp    160b <goodsoffer+0x49b>
cmpl   $0x1,-0x58(%rbp)
jne    1606 <goodsoffer+0x496>
mov    -0x48(%rbp),%rdi
mov    -0x84(%rbp),%esi
call   1080 <removeslave@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jg     1599 <goodsoffer+0x429>
mov    -0x40(%rbp),%rax
movslq -0x58(%rbp),%rcx
movslq -0x80(%rbp,%rcx,4),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1568 <goodsoffer+0x3f8>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x50(%rbp),%r9
mov    0x10(%rbp),%r15
mov    0x18(%rbp),%r14
mov    0x20(%rbp),%rbx
mov    0x28(%rbp),%r11
mov    0x30(%rbp),%r10
mov    0x38(%rbp),%rax
xor    %r12d,%r12d
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x1,0x38(%rsp)
movl   $0x0,0x40(%rsp)
call   1030 <treasure@plt>
jmp    160b <goodsoffer+0x49b>
jmp    1610 <goodsoffer+0x4a0>
cmpl   $0x0,-0x58(%rbp)
jl     1484 <goodsoffer+0x314>
jmp    161f <goodsoffer+0x4af>
jmp    1624 <goodsoffer+0x4b4>
mov    -0x54(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    0x18(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,4),%edi
call   1090 <valueitem@plt>
mov    %eax,%ecx
mov    -0xb0(%rbp),%eax
cmp    %ecx,%eax
jl     11ee <goodsoffer+0x7e>
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<goodsoffer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,0x68(%rsp)
mov    %r8,0x18(%rsp)
mov    %rcx,%rbx
mov    %rdx,0x60(%rsp)
mov    %rsi,0x58(%rsp)
mov    %rdi,0x50(%rsp)
mov    0xe0(%rsp),%rbp
mov    0xc8(%rsp),%r14
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x40(%rsp)
movl   $0xa,0xc(%rsp)
mov    $0xffffffff,%r12d
lea    0xea3(%rip),%r15
xor    %r13d,%r13d
jmp    1236 <goodsoffer+0xa6>
nopl   (%rax)
movslq 0x0(%rbp),%rax
mov    (%r14,%rax,4),%edi
call   10b0 <valueitem@plt>
lea    0xe16(%rip),%rdi
mov    %eax,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
movslq 0x0(%rbp),%rax
mov    (%r14,%rax,4),%edi
call   10b0 <valueitem@plt>
cmp    %eax,%r13d
jge    15a4 <goodsoffer+0x414>
mov    %r15,%rdi
call   1050 <puts@plt>
lea    0xc(%rsp),%rdi
call   1070 <getint@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     12d0 <goodsoffer+0x140>
test   %eax,%eax
jne    12a0 <goodsoffer+0x110>
lea    0xf2c(%rip),%rdi
call   1050 <puts@plt>
lea    0xc(%rsp),%rdi
call   1070 <getint@plt>
mov    0xc(%rsp),%eax
cmp    $0x9,%rax
ja     12a0 <goodsoffer+0x110>
mov    (%rbx,%rax,4),%edi
test   %edi,%edi
je     12a0 <goodsoffer+0x110>
call   10b0 <valueitem@plt>
add    %eax,%r13d
movslq 0xc(%rsp),%rax
mov    (%rbx,%rax,4),%eax
movslq %r12d,%rcx
add    $0x1,%r12d
mov    %eax,0x24(%rsp,%rcx,4)
jmp    1300 <goodsoffer+0x170>
nopl   0x0(%rax)
lea    0xf03(%rip),%rdi
call   1050 <puts@plt>
lea    0xc(%rsp),%rdi
call   1070 <getint@plt>
cmpl   $0x1,0xc(%rsp)
jne    1300 <goodsoffer+0x170>
jmp    1598 <goodsoffer+0x408>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x18(%rsp),%rdi
call   1090 <numslav@plt>
mov    0x10(%rsp),%ecx
cmp    %eax,%ecx
jge    12ef <goodsoffer+0x15f>
add    $0x1,%ecx
mov    %ecx,0x10(%rsp)
add    $0x8,%r13d
jmp    1300 <goodsoffer+0x170>
lea    0xd0a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
nopl   (%rax)
movslq 0x0(%rbp),%rax
mov    (%r14,%rax,4),%edi
call   10b0 <valueitem@plt>
cmp    %eax,%r13d
jl     1200 <goodsoffer+0x70>
lea    0xd4a(%rip),%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1060 <printf@plt>
movl   $0x0,0xc(%rsp)
lea    0xe42(%rip),%rdi
test   %r12d,%r12d
js     13a5 <goodsoffer+0x215>
xor    %eax,%eax
lea    0x70(%rsp),%r14
lea    0xd4d(%rip),%r15
nopw   0x0(%rax,%rax,1)
cltq
mov    0x20(%rsp,%rax,4),%esi
mov    %r14,%rdi
call   1080 <nameitem@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
cmp    %r12d,0xc(%rsp)
setge  %al
lea    (%rax,%rax,1),%edi
add    $0x2c,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    %r12d,%ecx
jl     1350 <goodsoffer+0x1c0>
test   %r12d,%r12d
lea    0xdeb(%rip),%rdi
lea    0xdd8(%rip),%rax
cmovs  %rax,%rdi
mov    %r13d,0x14(%rsp)
call   1050 <puts@plt>
movl   $0xffffffff,0xc(%rsp)
ff
lea    0x1(%r12),%r15d
lea    -0x1(%r15),%rax
mov    %rax,0x48(%rsp)
mov    %r15d,%r14d
and    $0x3,%r14d
mov    %r15d,%r13d
and    $0xfffffffc,%r13d
jmp    13f0 <goodsoffer+0x260>
cs nopw 0x0(%rax,%rax,1)
nop
test   %eax,%eax
je     1523 <goodsoffer+0x393>
test   %eax,%eax
jns    150a <goodsoffer+0x37a>
lea    0xcea(%rip),%rdi
call   1050 <puts@plt>
lea    0xc(%rsp),%rdi
call   1070 <getint@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
jne    13e0 <goodsoffer+0x250>
mov    0x18(%rsp),%rdi
mov    0x10(%rsp),%esi
call   10a0 <removeslave@plt>
test   %r12d,%r12d
js     142e <goodsoffer+0x29e>
cmpq   $0x3,0x48(%rsp)
jae    1432 <goodsoffer+0x2a2>
xor    %eax,%eax
jmp    1479 <goodsoffer+0x2e9>
xor    %ecx,%ecx
jmp    14a7 <goodsoffer+0x317>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq 0x20(%rsp,%rax,4),%rcx
movl   $0x0,(%rbx,%rcx,4)
movslq 0x24(%rsp,%rax,4),%rcx
movl   $0x0,(%rbx,%rcx,4)
movslq 0x28(%rsp,%rax,4),%rcx
movl   $0x0,(%rbx,%rcx,4)
movslq 0x2c(%rsp,%rax,4),%rcx
movl   $0x0,(%rbx,%rcx,4)
add    $0x4,%rax
cmp    %rax,%r13
jne    1440 <goodsoffer+0x2b0>
mov    %r15d,%ecx
test   %r14,%r14
je     14a7 <goodsoffer+0x317>
lea    (%rsp,%rax,4),%rax
add    $0x20,%rax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movslq (%rax,%rcx,4),%rdx
movl   $0x0,(%rbx,%rdx,4)
add    $0x1,%rcx
cmp    %rcx,%r14
jne    1490 <goodsoffer+0x300>
mov    %r15d,%ecx
mov    %ecx,0xc(%rsp)
sub    $0x8,%rsp
mov    0x58(%rsp),%rdi
mov    0x60(%rsp),%rsi
mov    0x68(%rsp),%rdx
mov    %rbx,%rcx
mov    0x20(%rsp),%r8
mov    0x70(%rsp),%r9
push   $0x0
push   $0x1
push   $0x0
push   0x108(%rsp)
push   %rbp
push   0x108(%rsp)
push   0x108(%rsp)
push   0x108(%rsp)
push   0x108(%rsp)
call   1040 <treasure@plt>
add    $0x50,%rsp
mov    0xc(%rsp),%eax
test   %eax,%eax
js     13f0 <goodsoffer+0x260>
mov    0xc8(%rsp),%r14
lea    0xb82(%rip),%r15
mov    0x14(%rsp),%r13d
jmp    1220 <goodsoffer+0x90>
lea    0xbe3(%rip),%rdi
call   1050 <puts@plt>
lea    0xc(%rsp),%rdi
call   1070 <getint@plt>
cmpl   $0x1,0xc(%rsp)
mov    0xc8(%rsp),%r14
lea    0xb4e(%rip),%r15
mov    0x14(%rsp),%r13d
je     1598 <goodsoffer+0x408>
lea    0xbe5(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0xc(%rsp)
je     1598 <goodsoffer+0x408>
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x40(%rsp)
movl   $0xa,0xc(%rsp)
mov    $0xffffffff,%r12d
movl   $0x0,0x10(%rsp)
jmp    1220 <goodsoffer+0x90>
lea    0xc52(%rip),%rdi
call   1050 <puts@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [71 x i8] c"'What do you want to offer? An item or a slave?'\0A[0]: Item\0A[1]: Slave\0A\00"
@.str.1 = [35 x i8] c"'What item do you want to offer?'\0A\00"
@.str.2 = [72 x i8] c"'Are you kidding me? Do you want to abort the trade?'\0A[0]: No\0A[1]: Yes\0A\00"
@.str.3 = [24 x i8] c"You aborted the trade.\0A\00"
@.str.4 = [42 x i8] c"'You don't have enough slaves to offer!\0A'\00"
@.str.5 = [61 x i8] c"'My item is valued %d gems and you offer is worth %d gems.'\0A\00"
@.str.6 = [48 x i8] c"'I'm satisfied with your offer of %d slaves and\00"
@.str.7 = [4 x i8] c" %s\00"
@.str.8 = [2 x i8] c",\00"
@.str.9 = [2 x i8] c".\00"
@.str.10 = [16 x i8] c"nothing else.'\0A\00"
@.str.11 = [4 x i8] c".'\0A\00"
@.str.12 = [45 x i8] c"'Do you accept the trade?'\0A[0]: No\0A[1]: Yes\0A\00"
@.str.13 = [52 x i8] c"'Do you want to abort the trade?'\0A[0]: No\0A[1]: Yes\0A\00"
@.str.14 = [58 x i8] c"'Do you want to propose another offer?'\0A[0]: No\0A[1]: Yes\0A\00"
define void @goodsoffer(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11) {
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32*
%24 = alloca i32*
%25 = alloca i32
%26 = alloca i32
%27 = alloca [10 x i32]
%28 = alloca i32
%29 = alloca [20 x i8]
%30 = alloca i32
store i32* %0, i32** %13
store i32* %1, i32** %14
store i32* %2, i32** %15
store i32* %3, i32** %16
store i32* %4, i32** %17
store i32* %5, i32** %18
store i32* %6, i32** %19
store i32* %7, i32** %20
store i32* %8, i32** %21
store i32* %9, i32** %22
store i32* %10, i32** %23
store i32* %11, i32** %24
store i32 0, i32* %25
store i32 0, i32* %26
br label %31
31: ; preds = %38, %12
%32 = load i32, i32* %26
%33 = icmp slt i32 %32, 10
br i1 %33, label %34, label %41
34: ; preds = %31
%35 = load i32, i32* %26
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %27, i64 0, i64 %36
store i32 0, i32* %37
br label %38
38: ; preds = %34
%39 = load i32, i32* %26
%40 = add nsw i32 %39, 1
store i32 %40, i32* %26
br label %31
41: ; preds = %31
store i32 -1, i32* %30
br label %42
42: ; preds = %243, %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%44 = call i32 @getint(i32* %26)
%45 = load i32, i32* %26
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %90
47: ; preds = %42
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%49 = call i32 @getint(i32* %26)
%50 = load i32, i32* %26
%51 = icmp slt i32 %50, 0
br i1 %51, label %62, label %52
52: ; preds = %47
%53 = load i32, i32* %26
%54 = icmp sge i32 %53, 10
br i1 %54, label %62, label %55
55: ; preds = %52
%56 = load i32*, i32** %16
%57 = load i32, i32* %26
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %56, i64 %58
%60 = load i32, i32* %59
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %70
62: ; preds = %55, %52, %47
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0))
%64 = call i32 @getint(i32* %26)
%65 = load i32, i32* %26
%66 = icmp eq i32 %65, 1
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %253
69: ; preds = %62
br label %89
70: ; preds = %55
%71 = load i32*, i32** %16
%72 = load i32, i32* %26
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i32, i32* %71, i64 %73
%75 = load i32, i32* %74
%76 = call i32 @valueitem(i32 %75)
%77 = load i32, i32* %25
%78 = add nsw i32 %77, %76
store i32 %78, i32* %25
%79 = load i32, i32* %30
%80 = add nsw i32 %79, 1
store i32 %80, i32* %30
%81 = load i32*, i32** %16
%82 = load i32, i32* %26
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i32, i32* %81, i64 %83
%85 = load i32, i32* %84
%86 = load i32, i32* %30
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [10 x i32], [10 x i32]* %27, i64 0, i64 %87
store i32 %85, i32* %88
br label %89
89: ; preds = %70, %69
br label %115
90: ; preds = %42
%91 = load i32, i32* %26
%92 = icmp eq i32 %91, 1
br i1 %92, label %93, label %106
93: ; preds = %90
%94 = load i32, i32* %28
%95 = load i32*, i32** %17
%96 = call i32 @numslav(i32* %95)
%97 = icmp sge i32 %94, %96
br i1 %97, label %98, label %100
98: ; preds = %93
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
br label %105
100: ; preds = %93
%101 = load i32, i32* %28
%102 = add nsw i32 %101, 1
store i32 %102, i32* %28
%103 = load i32, i32* %25
%104 = add nsw i32 %103, 8
store i32 %104, i32* %25
br label %105
105: ; preds = %100, %98
br label %114
106: ; preds = %90
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0))
%108 = call i32 @getint(i32* %26)
%109 = load i32, i32* %26
%110 = icmp eq i32 %109, 1
br i1 %110, label %111, label %113
111: ; preds = %106
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %253
113: ; preds = %106
br label %114
114: ; preds = %113, %105
br label %115
115: ; preds = %114, %89
%116 = load i32, i32* %25
%117 = load i32*, i32** %20
%118 = load i32*, i32** %23
%119 = load i32, i32* %118
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i32, i32* %117, i64 %120
%122 = load i32, i32* %121
%123 = call i32 @valueitem(i32 %122)
%124 = icmp slt i32 %116, %123
br i1 %124, label %125, label %135
125: ; preds = %115
%126 = load i32*, i32** %20
%127 = load i32*, i32** %23
%128 = load i32, i32* %127
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i32, i32* %126, i64 %129
%131 = load i32, i32* %130
%132 = call i32 @valueitem(i32 %131)
%133 = load i32, i32* %25
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %132, i32 %133)
br label %242
135: ; preds = %115
%136 = load i32, i32* %28
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i32 %136)
store i32 0, i32* %26
br label %138
138: ; preds = %159, %135
%139 = load i32, i32* %26
%140 = load i32, i32* %30
%141 = icmp sle i32 %139, %140
br i1 %141, label %142, label %162
142: ; preds = %138
%143 = getelementptr inbounds [20 x i8], [20 x i8]* %29, i64 0, i64 0
%144 = load i32, i32* %26
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [10 x i32], [10 x i32]* %27, i64 0, i64 %145
%147 = load i32, i32* %146
%148 = call i32 @nameitem(i8* %143, i32 %147)
%149 = getelementptr inbounds [20 x i8], [20 x i8]* %29, i64 0, i64 0
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %149)
%151 = load i32, i32* %26
%152 = load i32, i32* %30
%153 = icmp slt i32 %151, %152
br i1 %153, label %154, label %156
154: ; preds = %142
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %158
156: ; preds = %142
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %158
158: ; preds = %156, %154
br label %159
159: ; preds = %158
%160 = load i32, i32* %26
%161 = add nsw i32 %160, 1
store i32 %161, i32* %26
br label %138
162: ; preds = %138
%163 = load i32, i32* %30
%164 = icmp slt i32 %163, 0
br i1 %164, label %165, label %167
165: ; preds = %162
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
br label %169
167: ; preds = %162
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %169
169: ; preds = %167, %165
store i32 -1, i32* %26
br label %170
170: ; preds = %238, %169
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0))
%172 = call i32 @getint(i32* %26)
%173 = load i32, i32* %26
%174 = icmp eq i32 %173, 0
br i1 %174, label %175, label %200
175: ; preds = %170
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.13, i64 0, i64 0))
%177 = call i32 @getint(i32* %26)
%178 = load i32, i32* %26
%179 = icmp eq i32 %178, 1
br i1 %179, label %180, label %182
180: ; preds = %175
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %253
182: ; preds = %175
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.14, i64 0, i64 0))
%184 = load i32, i32* %26
%185 = icmp eq i32 %184, 0
br i1 %185, label %186, label %188
186: ; preds = %182
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %253
188: ; preds = %182
store i32 0, i32* %26
br label %189
189: ; preds = %196, %188
%190 = load i32, i32* %26
%191 = icmp slt i32 %190, 10
br i1 %191, label %192, label %199
192: ; preds = %189
%193 = load i32, i32* %26
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds [10 x i32], [10 x i32]* %27, i64 0, i64 %194
store i32 0, i32* %195
br label %196
196: ; preds = %192
%197 = load i32, i32* %26
%198 = add nsw i32 %197, 1
store i32 %198, i32* %26
br label %189
199: ; preds = %189
store i32 0, i32* %28
store i32 -1, i32* %30
br label %237
200: ; preds = %170
%201 = load i32, i32* %26
%202 = icmp eq i32 %201, 1
br i1 %202, label %203, label %236
203: ; preds = %200
%204 = load i32*, i32** %17
%205 = load i32, i32* %28
%206 = call i32 @removeslave(i32* %204, i32 %205)
store i32 0, i32* %26
br label %207
207: ; preds = %219, %203
%208 = load i32, i32* %26
%209 = load i32, i32* %30
%210 = icmp sle i32 %208, %209
br i1 %210, label %211, label %222
211: ; preds = %207
%212 = load i32*, i32** %16
%213 = load i32, i32* %26
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds [10 x i32], [10 x i32]* %27, i64 0, i64 %214
%216 = load i32, i32* %215
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds i32, i32* %212, i64 %217
store i32 0, i32* %218
br label %219
219: ; preds = %211
%220 = load i32, i32* %26
%221 = add nsw i32 %220, 1
store i32 %221, i32* %26
br label %207
222: ; preds = %207
%223 = load i32*, i32** %13
%224 = load i32*, i32** %14
%225 = load i32*, i32** %15
%226 = load i32*, i32** %16
%227 = load i32*, i32** %17
%228 = load i32*, i32** %18
%229 = load i32*, i32** %19
%230 = load i32*, i32** %20
%231 = load i32*, i32** %21
%232 = load i32*, i32** %22
%233 = load i32*, i32** %23
%234 = load i32*, i32** %24
%235 = call i32 @treasure(i32* %223, i32* %224, i32* %225, i32* %226, i32* %227, i32* %228, i32* %229, i32* %230, i32* %231, i32* %232, i32* %233, i32* %234, i32 0, i32 1, i32 0)
br label %236
236: ; preds = %222, %200
br label %237
237: ; preds = %236, %199
br label %238
238: ; preds = %237
%239 = load i32, i32* %26
%240 = icmp slt i32 %239, 0
br i1 %240, label %170, label %241
241: ; preds = %238
br label %242
242: ; preds = %241, %125
br label %243
243: ; preds = %242
%244 = load i32, i32* %25
%245 = load i32*, i32** %20
%246 = load i32*, i32** %23
%247 = load i32, i32* %246
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds i32, i32* %245, i64 %248
%250 = load i32, i32* %249
%251 = call i32 @valueitem(i32 %250)
%252 = icmp slt i32 %244, %251
br i1 %252, label %42, label %253
253: ; preds = %67, %111, %180, %186, %243
ret void
}

LLVM IR (-O2):
@.str.4 = [42 x i8] c"'You don't have enough slaves to offer!\0A'\00"
@.str.5 = [61 x i8] c"'My item is valued %d gems and you offer is worth %d gems.'\0A\00"
@.str.6 = [48 x i8] c"'I'm satisfied with your offer of %d slaves and\00"
@.str.7 = [4 x i8] c" %s\00"
@str = [70 x i8] c"'What do you want to offer? An item or a slave?'\0A[0]: Item\0A[1]: Slave\00"
@str.16 = [3 x i8] c".'\00"
@str.17 = [44 x i8] c"'Do you accept the trade?'\0A[0]: No\0A[1]: Yes\00"
@str.18 = [51 x i8] c"'Do you want to abort the trade?'\0A[0]: No\0A[1]: Yes\00"
@str.19 = [57 x i8] c"'Do you want to propose another offer?'\0A[0]: No\0A[1]: Yes\00"
@str.22 = [15 x i8] c"nothing else.'\00"
@str.24 = [34 x i8] c"'What item do you want to offer?'\00"
@str.25 = [71 x i8] c"'Are you kidding me? Do you want to abort the trade?'\0A[0]: No\0A[1]: Yes\00"
@str.26 = [23 x i8] c"You aborted the trade.\00"
define void @goodsoffer(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11) {
%13 = alloca i32
%14 = alloca [10 x i32]
%15 = bitcast [10 x i32]* %14 to i8*
%16 = alloca [20 x i8]
%17 = bitcast i32* %13 to i8*
store i32 10, i32* %13
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %16, i64 0, i64 0
br label %19
19: ; preds = %171, %12
%20 = phi i32 [ 0, %12 ], [ %65, %171 ]
%21 = phi i32 [ undef, %12 ], [ %172, %171 ]
%22 = phi i32 [ -1, %12 ], [ %173, %171 ]
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
%24 = call i32 @getint(i32* %13)
%25 = load i32, i32* %13
switch i32 %25, label %59 [
i32 0, label %26
i32 1, label %51
]
26: ; preds = %19
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.24, i64 0, i64 0))
%28 = call i32 @getint(i32* %13)
%29 = load i32, i32* %13
%30 = icmp ugt i32 %29, 9
br i1 %30, label %36, label %31
31: ; preds = %26
%32 = zext i32 %29 to i64
%33 = getelementptr inbounds i32, i32* %3, i64 %32
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %31, %26
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.25, i64 0, i64 0))
%38 = call i32 @getint(i32* %13)
%39 = load i32, i32* %13
%40 = icmp eq i32 %39, 1
br i1 %40, label %180, label %64
41: ; preds = %31
%42 = call i32 @valueitem(i32 %34)
%43 = add nsw i32 %42, %20
%44 = add nsw i32 %22, 1
%45 = load i32, i32* %13
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %3, i64 %46
%48 = load i32, i32* %47
%49 = sext i32 %44 to i64
%50 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %49
store i32 %48, i32* %50
br label %64
51: ; preds = %19
%52 = call i32 @numslav(i32* %4)
%53 = icmp slt i32 %21, %52
br i1 %53, label %56, label %54
54: ; preds = %51
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
br label %64
56: ; preds = %51
%57 = add nsw i32 %21, 1
%58 = add nsw i32 %20, 8
br label %64
59: ; preds = %19
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.25, i64 0, i64 0))
%61 = call i32 @getint(i32* %13)
%62 = load i32, i32* %13
%63 = icmp eq i32 %62, 1
br i1 %63, label %180, label %64
64: ; preds = %56, %54, %59, %41, %36
%65 = phi i32 [ %20, %36 ], [ %43, %41 ], [ %20, %54 ], [ %58, %56 ], [ %20, %59 ]
%66 = phi i32 [ %21, %36 ], [ %21, %41 ], [ %21, %54 ], [ %57, %56 ], [ %21, %59 ]
%67 = phi i32 [ %22, %36 ], [ %44, %41 ], [ %22, %54 ], [ %22, %56 ], [ %22, %59 ]
%68 = load i32, i32* %10
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %7, i64 %69
%71 = load i32, i32* %70
%72 = call i32 @valueitem(i32 %71)
%73 = icmp slt i32 %65, %72
br i1 %73, label %74, label %81
74: ; preds = %64
%75 = load i32, i32* %10
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %7, i64 %76
%78 = load i32, i32* %77
%79 = call i32 @valueitem(i32 %78)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %79, i32 %65)
br label %171
81: ; preds = %64
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i32 %66)
store i32 0, i32* %13
%83 = icmp slt i32 %67, 0
br i1 %83, label %100, label %84
84: ; preds = %81, %84
%85 = phi i32 [ %96, %84 ], [ 0, %81 ]
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = call i32 @nameitem(i8* %18, i32 %88)
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %18)
%91 = load i32, i32* %13
%92 = icmp slt i32 %91, %67
%93 = select i1 %92, i32 44, i32 46
%94 = call i32 @putchar(i32 %93)
%95 = load i32, i32* %13
%96 = add nsw i32 %95, 1
store i32 %96, i32* %13
%97 = icmp slt i32 %95, %67
br i1 %97, label %84, label %98
98: ; preds = %84
%99 = select i1 %83, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.22, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.16, i64 0, i64 0)
br label %100
100: ; preds = %98, %81
%101 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.22, i64 0, i64 0), %81 ], [ %99, %98 ]
%102 = call i32 @puts(i8* dereferenceable(1) %101)
store i32 -1, i32* %13
%103 = add i32 %67, 1
%104 = zext i32 %103 to i64
%105 = add nsw i64 %104, -1
%106 = and i64 %104, 3
%107 = icmp ult i64 %105, 3
%108 = and i64 %104, 4294967292
%109 = icmp eq i64 %106, 0
br label %110
110: ; preds = %168, %100
%111 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.17, i64 0, i64 0))
%112 = call i32 @getint(i32* %13)
%113 = load i32, i32* %13
switch i32 %113, label %168 [
i32 0, label %114
i32 1, label %124
]
114: ; preds = %110
%115 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.18, i64 0, i64 0))
%116 = call i32 @getint(i32* %13)
%117 = load i32, i32* %13
%118 = icmp eq i32 %117, 1
br i1 %118, label %180, label %119
119: ; preds = %114
%120 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.19, i64 0, i64 0))
%121 = load i32, i32* %13
%122 = icmp eq i32 %121, 0
br i1 %122, label %180, label %123
123: ; preds = %119
store i32 10, i32* %13
br label %171
124: ; preds = %110
%125 = call i32 @removeslave(i32* %4, i32 %66)
br i1 %83, label %164, label %126
126: ; preds = %124
br i1 %107, label %152, label %127
127: ; preds = %126, %127
%128 = phi i64 [ %149, %127 ], [ 0, %126 ]
%129 = phi i64 [ %150, %127 ], [ 0, %126 ]
%130 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %128
%131 = load i32, i32* %130
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i32, i32* %3, i64 %132
store i32 0, i32* %133
%134 = or i64 %128, 1
%135 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %134
%136 = load i32, i32* %135
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i32, i32* %3, i64 %137
store i32 0, i32* %138
%139 = or i64 %128, 2
%140 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %139
%141 = load i32, i32* %140
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds i32, i32* %3, i64 %142
store i32 0, i32* %143
%144 = or i64 %128, 3
%145 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %144
%146 = load i32, i32* %145
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds i32, i32* %3, i64 %147
store i32 0, i32* %148
%149 = add nuw nsw i64 %128, 4
%150 = add i64 %129, 4
%151 = icmp eq i64 %150, %108
br i1 %151, label %152, label %127
152: ; preds = %127, %126
%153 = phi i64 [ 0, %126 ], [ %149, %127 ]
br i1 %109, label %164, label %154
154: ; preds = %152, %154
%155 = phi i64 [ %161, %154 ], [ %153, %152 ]
%156 = phi i64 [ %162, %154 ], [ 0, %152 ]
%157 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %155
%158 = load i32, i32* %157
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds i32, i32* %3, i64 %159
store i32 0, i32* %160
%161 = add nuw nsw i64 %155, 1
%162 = add i64 %156, 1
%163 = icmp eq i64 %162, %106
br i1 %163, label %164, label %154
164: ; preds = %152, %154, %124
%165 = phi i32 [ 0, %124 ], [ %103, %154 ], [ %103, %152 ]
store i32 %165, i32* %13
%166 = call i32 @treasure(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 0, i32 1, i32 0)
%167 = load i32, i32* %13
br label %168
168: ; preds = %110, %164
%169 = phi i32 [ %113, %110 ], [ %167, %164 ]
%170 = icmp slt i32 %169, 0
br i1 %170, label %110, label %171
171: ; preds = %168, %123, %74
%172 = phi i32 [ %66, %74 ], [ 0, %123 ], [ %66, %168 ]
%173 = phi i32 [ %67, %74 ], [ -1, %123 ], [ %67, %168 ]
%174 = load i32, i32* %10
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i32, i32* %7, i64 %175
%177 = load i32, i32* %176
%178 = call i32 @valueitem(i32 %177)
%179 = icmp slt i32 %65, %178
br i1 %179, label %19, label %183
180: ; preds = %119, %114, %59, %36
%181 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.26, i64 0, i64 0), %36 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.26, i64 0, i64 0), %59 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.26, i64 0, i64 0), %114 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.26, i64 0, i64 0), %119 ]
%182 = call i32 @puts(i8* dereferenceable(1) %181)
br label %183
183: ; preds = %171, %180
ret void
}