#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*/ addch(char);
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
int /*<<< orphan*/ printw(char *);
void first_draw(int maxx) {
  int i;
  maxx -= 9;
  move(0, 0);
  if (maxx % 2 == 0) {
    maxx /= 2;
    for (i = 0; i < maxx; i++)
      addch('=');
    printw(" MaxDice ");
    for (i = 0; i < maxx; i++)
      addch('=');
  } else {
    maxx--;
    maxx /= 2;
    for (i = 0; i < maxx; i++)
      addch('=');
    printw(" MaxDice ");
    for (i = 0; i <= maxx; i++)
      addch('=');
  }
  move(1, 0);
  return;
}


x86 assembly (clang, -O0):
<first_draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x9,%eax
mov    %eax,-0x4(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1050 <move@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d6 <first_draw+0xa6>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119a <first_draw+0x6a>
mov    $0x3d,%edi
call   1040 <addch@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <first_draw+0x46>
lea    0xe5f(%rip),%rdi
call   1030 <printw@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d1 <first_draw+0xa1>
mov    $0x3d,%edi
call   1040 <addch@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ad <first_draw+0x7d>
jmp    1254 <first_draw+0x124>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1218 <first_draw+0xe8>
mov    $0x3d,%edi
call   1040 <addch@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f4 <first_draw+0xc4>
lea    0xde1(%rip),%rdi
call   1030 <printw@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     124f <first_draw+0x11f>
mov    $0x3d,%edi
call   1040 <addch@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    122b <first_draw+0xfb>
jmp    1254 <first_draw+0x124>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <move@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<first_draw>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    -0x9(%rbx),%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1050 <move@plt>
test   $0x1,%bpl
jne    11c1 <first_draw+0x91>
cmp    $0xa,%ebx
jle    1231 <first_draw+0x101>
mov    %ebp,%r14d
shr    $0x1f,%r14d
add    %ebp,%r14d
sar    %r14d
cmp    $0x2,%r14d
mov    $0x1,%ebp
cmovge %r14d,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x3d,%edi
call   1040 <addch@plt>
add    $0xffffffff,%ebp
jne    1170 <first_draw+0x40>
lea    0xe7a(%rip),%rdi
call   1030 <printw@plt>
cmp    $0xb,%ebx
jl     123d <first_draw+0x10d>
cmp    $0x2,%r14d
mov    $0x1,%ebx
cmovge %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x3d,%edi
call   1040 <addch@plt>
add    $0xffffffff,%ebx
jne    11b0 <first_draw+0x80>
jmp    123d <first_draw+0x10d>
lea    -0xa(%rbx),%eax
shr    $0x1f,%eax
lea    (%rbx,%rax,1),%r14d
add    $0xfffffff6,%r14d
sar    %r14d
cmp    $0xc,%ebx
jl     11ff <first_draw+0xcf>
cmp    $0x2,%r14d
mov    $0x1,%ebp
cmovge %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x3d,%edi
call   1040 <addch@plt>
add    $0xffffffff,%ebp
jne    11f0 <first_draw+0xc0>
lea    0xdfa(%rip),%rdi
call   1030 <printw@plt>
cmp    $0x9,%ebx
jl     123d <first_draw+0x10d>
xor    %ebx,%ebx
test   %r14d,%r14d
cmovg  %r14d,%ebx
add    $0x1,%ebx
nopl   0x0(%rax)
mov    $0x3d,%edi
call   1040 <addch@plt>
add    $0xffffffff,%ebx
jne    1220 <first_draw+0xf0>
jmp    123d <first_draw+0x10d>
lea    0xdc8(%rip),%rdi
call   1030 <printw@plt>
mov    $0x1,%edi
xor    %esi,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <move@plt>

LLVM IR (-O0):
@.str = [10 x i8] c" MaxDice \00"
define void @first_draw(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 9
store i32 %5, i32* %2
%6 = call i32 @move(i32 0, i32 0)
%7 = load i32, i32* %2
%8 = srem i32 %7, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %34
10: ; preds = %1
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 2
store i32 %12, i32* %2
store i32 0, i32* %3
br label %13
13: ; preds = %19, %10
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @addch(i8 signext 61)
br label %19
19: ; preds = %17
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %13
22: ; preds = %13
%23 = call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %24
24: ; preds = %30, %22
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 @addch(i8 signext 61)
br label %30
30: ; preds = %28
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %24
33: ; preds = %24
br label %60
34: ; preds = %1
%35 = load i32, i32* %2
%36 = add nsw i32 %35, -1
store i32 %36, i32* %2
%37 = load i32, i32* %2
%38 = sdiv i32 %37, 2
store i32 %38, i32* %2
store i32 0, i32* %3
br label %39
39: ; preds = %45, %34
%40 = load i32, i32* %3
%41 = load i32, i32* %2
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %48
43: ; preds = %39
%44 = call i32 @addch(i8 signext 61)
br label %45
45: ; preds = %43
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %39
48: ; preds = %39
%49 = call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %50
50: ; preds = %56, %48
%51 = load i32, i32* %3
%52 = load i32, i32* %2
%53 = icmp sle i32 %51, %52
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = call i32 @addch(i8 signext 61)
br label %56
56: ; preds = %54
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %50
59: ; preds = %50
br label %60
60: ; preds = %59, %33
%61 = call i32 @move(i32 1, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c" MaxDice \00"
define void @first_draw(i32 %0) {
%2 = add nsw i32 %0, -9
%3 = tail call i32 @move(i32 0, i32 0)
%4 = and i32 %2, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %27
6: ; preds = %1
%7 = sdiv i32 %2, 2
%8 = icmp sgt i32 %0, 10
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %48
11: ; preds = %6
%12 = call i32 @llvm.smax.i32(i32 %7, i32 1)
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ %16, %13 ], [ 0, %11 ]
%15 = tail call i32 @addch(i8 signext 61)
%16 = add nuw nsw i32 %14, 1
%17 = icmp eq i32 %16, %12
br i1 %17, label %18, label %13
18: ; preds = %13
%19 = tail call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br i1 %8, label %20, label %48
20: ; preds = %18
%21 = call i32 @llvm.smax.i32(i32 %7, i32 1)
br label %22
22: ; preds = %20, %22
%23 = phi i32 [ %25, %22 ], [ 0, %20 ]
%24 = tail call i32 @addch(i8 signext 61)
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, %21
br i1 %26, label %48, label %22
27: ; preds = %1
%28 = add nsw i32 %0, -10
%29 = sdiv i32 %28, 2
%30 = icmp sgt i32 %0, 11
br i1 %30, label %31, label %38
31: ; preds = %27
%32 = call i32 @llvm.smax.i32(i32 %29, i32 1)
br label %33
33: ; preds = %31, %33
%34 = phi i32 [ %36, %33 ], [ 0, %31 ]
%35 = tail call i32 @addch(i8 signext 61)
%36 = add nuw nsw i32 %34, 1
%37 = icmp eq i32 %36, %32
br i1 %37, label %38, label %33
38: ; preds = %33, %27
%39 = tail call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%40 = icmp slt i32 %0, 9
br i1 %40, label %48, label %41
41: ; preds = %38
%42 = call i32 @llvm.smax.i32(i32 %29, i32 0)
br label %43
43: ; preds = %41, %43
%44 = phi i32 [ %46, %43 ], [ 0, %41 ]
%45 = tail call i32 @addch(i8 signext 61)
%46 = add nuw nsw i32 %44, 1
%47 = icmp eq i32 %44, %42
br i1 %47, label %48, label %43
48: ; preds = %43, %22, %9, %38, %18
%49 = tail call i32 @move(i32 1, i32 0)
ret void
}