#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*/ printf(char *);
void best(int s) {
  if (s >= 8) {
    printf("Province or Gold\n");
  } else if (s >= 6) {
    printf("Duchy or Gold\n");
  } else if (s >= 5) {
    printf("Duchy or Silver\n");
  } else if (s >= 3) {
    printf("Estate or Silver\n");
  } else if (s >= 2) {
    printf("Estate or Copper\n");
  } else {
    printf("Copper\n");
  }
}


x86 assembly (clang, -O0):
<best>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jl     1136 <best+0x26>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    11c2 <best+0xb2>
cmpl   $0x6,-0x4(%rbp)
jl     1151 <best+0x41>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
jmp    11bd <best+0xad>
cmpl   $0x5,-0x4(%rbp)
jl     116c <best+0x5c>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
jmp    11b8 <best+0xa8>
cmpl   $0x3,-0x4(%rbp)
jl     1187 <best+0x77>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    11b3 <best+0xa3>
cmpl   $0x2,-0x4(%rbp)
jl     11a2 <best+0x92>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    11ae <best+0x9e>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    11b3 <best+0xa3>
jmp    11b8 <best+0xa8>
jmp    11bd <best+0xad>
jmp    11c2 <best+0xb2>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<best>:
cmp    $0x7,%edi
jle    1121 <best+0x11>
lea    0xf24(%rip),%rdi
jmp    1030 <puts@plt>
cmp    $0x5,%edi
jle    1132 <best+0x22>
lea    0xf05(%rip),%rdi
jmp    1030 <puts@plt>
jne    1140 <best+0x30>
lea    0xee7(%rip),%rdi
jmp    1030 <puts@plt>
cmp    $0x2,%edi
jle    1151 <best+0x41>
lea    0xec5(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xea8(%rip),%rax
lea    0xeab(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Province or Gold\0A\00"
@.str.1 = [15 x i8] c"Duchy or Gold\0A\00"
@.str.2 = [17 x i8] c"Duchy or Silver\0A\00"
@.str.3 = [18 x i8] c"Estate or Silver\0A\00"
@.str.4 = [18 x i8] c"Estate or Copper\0A\00"
@.str.5 = [8 x i8] c"Copper\0A\00"
define void @best(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 8
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %33
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sge i32 %8, 6
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %32
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 5
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %31
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp sge i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %30
22: ; preds = %17
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 2
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %29
27: ; preds = %22
%28 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
br label %30
30: ; preds = %29, %20
br label %31
31: ; preds = %30, %15
br label %32
32: ; preds = %31, %10
br label %33
33: ; preds = %32, %5
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"Copper\00"
@str.6 = [17 x i8] c"Estate or Copper\00"
@str.7 = [17 x i8] c"Estate or Silver\00"
@str.8 = [16 x i8] c"Duchy or Silver\00"
@str.9 = [14 x i8] c"Duchy or Gold\00"
@str.10 = [17 x i8] c"Province or Gold\00"
define void @best(i32 %0) {
%2 = icmp sgt i32 %0, 7
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 5
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = icmp eq i32 %0, 5
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = icmp sgt i32 %0, 2
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = icmp eq i32 %0, 2
%11 = select i1 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0)
br label %12
12: ; preds = %9, %7, %5, %3, %1
%13 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0), %1 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0), %3 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0), %5 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0), %7 ], [ %11, %9 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
ret void
}