#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 */
typedef int /*<<< orphan*/ defRoll;
typedef int /*<<< orphan*/ attRoll;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ sort(int *, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int attacker, defender, x;
  attacker = 10;
  defender = 10;
  printf("Attacker army: %i\n", attacker);
  printf("Defender army: %i\n", defender);
  srand(time(NULL));
  while (attacker > 1 && defender >= 0) {
    int attRoll[3] = {0, 0, 0};
    int defRoll[2] = {0, 0};
    int *ap, *dp;
    x = 0;
    if (attacker > 3)
      while (x < 3)
        attRoll[x++] = (rand() % 6) + 1;
    else
      while (x < 2)
        attRoll[x++] = (rand() % 6) + 1;
    x = 0;
    if (defender > 1)
      while (x < 3)
        defRoll[x++] = (rand() % 6) + 1;
    else
      defRoll[x] = (rand() % 6) + 1;
    int defSize, attSize;
    defSize = sizeof(defRoll) / sizeof(*defRoll);
    attSize = sizeof(attRoll) / sizeof(*attRoll);
    sort(attRoll, attSize);
    sort(defRoll, defSize);
    if (defSize < attSize) {
      for (x = 0; x < defSize; x++)
        if (attRoll[x] > defRoll[x])
          defender--;
        else
          attacker--;
    } else {
      for (x = 0; x < attSize; x++)
        if (attRoll[x] > defRoll[x])
          defender--;
        else
          attacker--;
    }
  }
  if (attacker <= 0)
    attacker = 1;
  if (defender < 0)
    defender = 0;
  printf("Results:\nattack: %i\n", attacker);
  printf("defend: %i\n", defender);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x41(%rbp)
jle    11c4 <main+0x64>
cmpl   $0x0,-0xc(%rbp)
setge  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    11d4 <main+0x74>
jmp    13cb <main+0x26b>
lea    -0x1c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
lea    -0x24(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    1241 <main+0xe1>
jmp    120a <main+0xaa>
cmpl   $0x3,-0x10(%rbp)
jge    123c <main+0xdc>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
mov    %edx,-0x1c(%rbp,%rax,4)
jmp    120a <main+0xaa>
jmp    127d <main+0x11d>
jmp    1246 <main+0xe6>
cmpl   $0x2,-0x10(%rbp)
jge    1278 <main+0x118>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
mov    %edx,-0x1c(%rbp,%rax,4)
jmp    1246 <main+0xe6>
jmp    127d <main+0x11d>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    12ca <main+0x16a>
jmp    1293 <main+0x133>
cmpl   $0x3,-0x10(%rbp)
jge    12c5 <main+0x165>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
mov    %edx,-0x24(%rbp,%rax,4)
jmp    1293 <main+0x133>
jmp    12e4 <main+0x184>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
movslq -0x10(%rbp),%rax
mov    %edx,-0x24(%rbp,%rax,4)
movl   $0x2,-0x3c(%rbp)
movl   $0x3,-0x40(%rbp)
lea    -0x1c(%rbp),%rdi
mov    -0x40(%rbp),%esi
call   1040 <sort@plt>
lea    -0x24(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1040 <sort@plt>
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    136e <main+0x20e>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1369 <main+0x209>
movslq -0x10(%rbp),%rax
mov    -0x1c(%rbp,%rax,4),%eax
movslq -0x10(%rbp),%rcx
cmp    -0x24(%rbp,%rcx,4),%eax
jle    134d <main+0x1ed>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1356 <main+0x1f6>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    135b <main+0x1fb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    131d <main+0x1bd>
jmp    13c6 <main+0x266>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    13c1 <main+0x261>
movslq -0x10(%rbp),%rax
mov    -0x1c(%rbp,%rax,4),%eax
movslq -0x10(%rbp),%rcx
cmp    -0x24(%rbp,%rcx,4),%eax
jle    13a5 <main+0x245>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    13ae <main+0x24e>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    13b3 <main+0x253>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1375 <main+0x215>
jmp    13c6 <main+0x266>
jmp    11ab <main+0x4b>
cmpl   $0x0,-0x8(%rbp)
jg     13dc <main+0x27c>
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    13ed <main+0x28d>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xc2f(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xc35(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe9f(%rip),%rdi
mov    $0xa,%ebp
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0x8(%rsp),%r14
mov    %rsp,%r15
mov    $0xa,%ebx
nopl   0x0(%rax)
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x8(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
cmp    $0x3,%ebp
jbe    1250 <main+0x100>
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x10(%rsp)
jmp    1254 <main+0x104>
nopw   0x0(%rax,%rax,1)
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
cmp    $0x2,%ebx
jl     12f0 <main+0x1a0>
mov    %eax,(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x4(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x8(%rsp)
jmp    12f3 <main+0x1a3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,(%rsp)
mov    %r14,%rdi
mov    $0x3,%esi
call   1040 <sort@plt>
mov    %r15,%rdi
mov    $0x2,%esi
call   1040 <sort@plt>
mov    0x8(%rsp),%eax
mov    0xc(%rsp),%ecx
xor    %edx,%edx
xor    %esi,%esi
cmp    (%rsp),%eax
setle  %dl
setg   %sil
sub    %esi,%ebx
sub    %edx,%ebp
xor    %eax,%eax
xor    %edx,%edx
cmp    0x4(%rsp),%ecx
setle  %al
setg   %dl
sub    %edx,%ebx
sub    %eax,%ebp
cmp    $0x2,%ebp
jb     1346 <main+0x1f6>
test   %ebx,%ebx
jns    11a0 <main+0x50>
test   %ebp,%ebp
mov    $0x1,%esi
cmovne %ebp,%esi
xor    %eax,%eax
test   %ebx,%ebx
cmovs  %eax,%ebx
lea    0xcc8(%rip),%rdi
call   1030 <printf@plt>
lea    0xcd1(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Attacker army: %i\0A\00"
@.str.1 = [19 x i8] c"Defender army: %i\0A\00"
@.str.2 = [21 x i8] c"Results:\0Aattack: %i\0A\00"
@.str.3 = [12 x i8] c"defend: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [3 x i32]
%6 = alloca [2 x i32]
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 10, i32* %3
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = call i32 @time(i32* null)
%16 = call i32 @srand(i32 %15)
br label %17
17: ; preds = %141, %0
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp sge i32 %21, 0
br label %23
23: ; preds = %20, %17
%24 = phi i1 [ false, %17 ], [ %22, %20 ]
br i1 %24, label %25, label %142
25: ; preds = %23
%26 = bitcast [3 x i32]* %5 to i8*
%27 = bitcast [2 x i32]* %6 to i8*
store i32 0, i32* %4
%28 = load i32, i32* %2
%29 = icmp sgt i32 %28, 3
br i1 %29, label %30, label %43
30: ; preds = %25
br label %31
31: ; preds = %34, %30
%32 = load i32, i32* %4
%33 = icmp slt i32 %32, 3
br i1 %33, label %34, label %42
34: ; preds = %31
%35 = call i32 (...) @rand()
%36 = srem i32 %35, 6
%37 = add nsw i32 %36, 1
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 %40
store i32 %37, i32* %41
br label %31
42: ; preds = %31
br label %56
43: ; preds = %25
br label %44
44: ; preds = %47, %43
%45 = load i32, i32* %4
%46 = icmp slt i32 %45, 2
br i1 %46, label %47, label %55
47: ; preds = %44
%48 = call i32 (...) @rand()
%49 = srem i32 %48, 6
%50 = add nsw i32 %49, 1
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 %53
store i32 %50, i32* %54
br label %44
55: ; preds = %44
br label %56
56: ; preds = %55, %42
store i32 0, i32* %4
%57 = load i32, i32* %3
%58 = icmp sgt i32 %57, 1
br i1 %58, label %59, label %72
59: ; preds = %56
br label %60
60: ; preds = %63, %59
%61 = load i32, i32* %4
%62 = icmp slt i32 %61, 3
br i1 %62, label %63, label %71
63: ; preds = %60
%64 = call i32 (...) @rand()
%65 = srem i32 %64, 6
%66 = add nsw i32 %65, 1
%67 = load i32, i32* %4
%68 = add nsw i32 %67, 1
store i32 %68, i32* %4
%69 = sext i32 %67 to i64
%70 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 %69
store i32 %66, i32* %70
br label %60
71: ; preds = %60
br label %79
72: ; preds = %56
%73 = call i32 (...) @rand()
%74 = srem i32 %73, 6
%75 = add nsw i32 %74, 1
%76 = load i32, i32* %4
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 %77
store i32 %75, i32* %78
br label %79
79: ; preds = %72, %71
store i32 2, i32* %9
store i32 3, i32* %10
%80 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%81 = load i32, i32* %10
%82 = call i32 @sort(i32* %80, i32 %81)
%83 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%84 = load i32, i32* %9
%85 = call i32 @sort(i32* %83, i32 %84)
%86 = load i32, i32* %9
%87 = load i32, i32* %10
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %115
89: ; preds = %79
store i32 0, i32* %4
br label %90
90: ; preds = %111, %89
%91 = load i32, i32* %4
%92 = load i32, i32* %9
%93 = icmp slt i32 %91, %92
br i1 %93, label %94, label %114
94: ; preds = %90
%95 = load i32, i32* %4
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 %96
%98 = load i32, i32* %97
%99 = load i32, i32* %4
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 %100
%102 = load i32, i32* %101
%103 = icmp sgt i32 %98, %102
br i1 %103, label %104, label %107
104: ; preds = %94
%105 = load i32, i32* %3
%106 = add nsw i32 %105, -1
store i32 %106, i32* %3
br label %110
107: ; preds = %94
%108 = load i32, i32* %2
%109 = add nsw i32 %108, -1
store i32 %109, i32* %2
br label %110
110: ; preds = %107, %104
br label %111
111: ; preds = %110
%112 = load i32, i32* %4
%113 = add nsw i32 %112, 1
store i32 %113, i32* %4
br label %90
114: ; preds = %90
br label %141
115: ; preds = %79
store i32 0, i32* %4
br label %116
116: ; preds = %137, %115
%117 = load i32, i32* %4
%118 = load i32, i32* %10
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %140
120: ; preds = %116
%121 = load i32, i32* %4
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 %122
%124 = load i32, i32* %123
%125 = load i32, i32* %4
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 %126
%128 = load i32, i32* %127
%129 = icmp sgt i32 %124, %128
br i1 %129, label %130, label %133
130: ; preds = %120
%131 = load i32, i32* %3
%132 = add nsw i32 %131, -1
store i32 %132, i32* %3
br label %136
133: ; preds = %120
%134 = load i32, i32* %2
%135 = add nsw i32 %134, -1
store i32 %135, i32* %2
br label %136
136: ; preds = %133, %130
br label %137
137: ; preds = %136
%138 = load i32, i32* %4
%139 = add nsw i32 %138, 1
store i32 %139, i32* %4
br label %116
140: ; preds = %116
br label %141
141: ; preds = %140, %114
br label %17
142: ; preds = %23
%143 = load i32, i32* %2
%144 = icmp sle i32 %143, 0
br i1 %144, label %145, label %146
145: ; preds = %142
store i32 1, i32* %2
br label %146
146: ; preds = %145, %142
%147 = load i32, i32* %3
%148 = icmp slt i32 %147, 0
br i1 %148, label %149, label %150
149: ; preds = %146
store i32 0, i32* %3
br label %150
150: ; preds = %149, %146
%151 = load i32, i32* %2
%152 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %151)
%153 = load i32, i32* %3
%154 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %153)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Attacker army: %i\0A\00"
@.str.1 = [19 x i8] c"Defender army: %i\0A\00"
@.str.2 = [21 x i8] c"Results:\0Aattack: %i\0A\00"
@.str.3 = [12 x i8] c"defend: %i\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca i64
%3 = bitcast i64* %2 to [2 x i32]*
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 10)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 10)
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @srand(i32 %6)
%8 = bitcast [3 x i32]* %1 to i8*
%9 = bitcast i64* %2 to i8*
%10 = bitcast i64* %2 to i32*
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%15 = bitcast i64* %2 to i32*
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%17 = getelementptr inbounds i64, i64* %2, i64 1
%18 = bitcast i64* %17 to i32*
%19 = bitcast i64* %2 to i32*
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
br label %22
22: ; preds = %0, %50
%23 = phi i32 [ 10, %0 ], [ %68, %50 ]
%24 = phi i32 [ 10, %0 ], [ %65, %50 ]
store i64 0, i64* %2
%25 = icmp ugt i32 %23, 3
%26 = call i32 (...) @rand()
%27 = srem i32 %26, 6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %11
%29 = call i32 (...) @rand()
%30 = srem i32 %29, 6
%31 = add nsw i32 %30, 1
br i1 %25, label %33, label %32
32: ; preds = %22
store i32 %31, i32* %12
br label %37
33: ; preds = %22
store i32 %31, i32* %13
%34 = call i32 (...) @rand()
%35 = srem i32 %34, 6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %14
br label %37
37: ; preds = %32, %33
%38 = icmp sgt i32 %24, 1
%39 = call i32 (...) @rand()
%40 = srem i32 %39, 6
%41 = add nsw i32 %40, 1
br i1 %38, label %42, label %49
42: ; preds = %37
store i32 %41, i32* %15
%43 = call i32 (...) @rand()
%44 = srem i32 %43, 6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %16
%46 = call i32 (...) @rand()
%47 = srem i32 %46, 6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %18
br label %50
49: ; preds = %37
store i32 %41, i32* %10
br label %50
50: ; preds = %42, %49
%51 = call i32 @sort(i32* %11, i32 3)
%52 = call i32 @sort(i32* %10, i32 2)
%53 = load i32, i32* %11
%54 = load i32, i32* %19
%55 = icmp sgt i32 %53, %54
%56 = sext i1 %55 to i32
%57 = add nsw i32 %24, %56
%58 = xor i1 %55, true
%59 = sext i1 %58 to i32
%60 = add nsw i32 %23, %59
%61 = load i32, i32* %20
%62 = load i32, i32* %21
%63 = icmp sgt i32 %61, %62
%64 = sext i1 %63 to i32
%65 = add nsw i32 %57, %64
%66 = xor i1 %63, true
%67 = sext i1 %66 to i32
%68 = add nsw i32 %60, %67
%69 = icmp ugt i32 %68, 1
%70 = icmp sgt i32 %65, -1
%71 = select i1 %69, i1 %70, i1 false
br i1 %71, label %22, label %72
72: ; preds = %50
%73 = select i1 %69, i32 %68, i32 1
%74 = icmp sgt i32 %65, 0
%75 = select i1 %74, i32 %65, i32 0
%76 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %73)
%77 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %75)
ret i32 0
}