#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 numberOf(int);
int haveThreeTheSame() {
  int i;
  for (i = 1; i <= 6; i++) {
    if (numberOf(i) == 3) {
      return i;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<haveThreeTheSame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     1158 <haveThreeTheSame+0x48>
mov    -0x8(%rbp),%edi
call   1030 <numberOf@plt>
cmp    $0x3,%eax
jne    1145 <haveThreeTheSame+0x35>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <haveThreeTheSame+0x4f>
jmp    114a <haveThreeTheSame+0x3a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <haveThreeTheSame+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<haveThreeTheSame>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebx
mov    $0x1,%edi
call   1030 <numberOf@plt>
cmp    $0x3,%eax
je     118e <haveThreeTheSame+0x7e>
mov    $0x2,%ebx
mov    $0x2,%edi
call   1030 <numberOf@plt>
cmp    $0x3,%eax
je     118e <haveThreeTheSame+0x7e>
mov    $0x3,%ebx
mov    $0x3,%edi
call   1030 <numberOf@plt>
cmp    $0x3,%eax
je     118e <haveThreeTheSame+0x7e>
mov    $0x4,%ebx
mov    $0x4,%edi
call   1030 <numberOf@plt>
cmp    $0x3,%eax
je     118e <haveThreeTheSame+0x7e>
mov    $0x5,%ebx
mov    $0x5,%edi
call   1030 <numberOf@plt>
cmp    $0x3,%eax
je     118e <haveThreeTheSame+0x7e>
mov    $0x6,%ebp
mov    $0x6,%edi
call   1030 <numberOf@plt>
xor    %ebx,%ebx
cmp    $0x3,%eax
cmove  %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @haveThreeTheSame() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %2
br label %3
3: ; preds = %13, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 6
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @numberOf(i32 %7)
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = load i32, i32* %2
store i32 %11, i32* %1
br label %17
12: ; preds = %6
br label %13
13: ; preds = %12
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %3
16: ; preds = %3
store i32 0, i32* %1
br label %17
17: ; preds = %16, %10
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @haveThreeTheSame() {
%1 = tail call i32 @numberOf(i32 1)
%2 = icmp eq i32 %1, 3
br i1 %2, label %19, label %3
3: ; preds = %0
%4 = tail call i32 @numberOf(i32 2)
%5 = icmp eq i32 %4, 3
br i1 %5, label %19, label %6
6: ; preds = %3
%7 = tail call i32 @numberOf(i32 3)
%8 = icmp eq i32 %7, 3
br i1 %8, label %19, label %9
9: ; preds = %6
%10 = tail call i32 @numberOf(i32 4)
%11 = icmp eq i32 %10, 3
br i1 %11, label %19, label %12
12: ; preds = %9
%13 = tail call i32 @numberOf(i32 5)
%14 = icmp eq i32 %13, 3
br i1 %14, label %19, label %15
15: ; preds = %12
%16 = tail call i32 @numberOf(i32 6)
%17 = icmp eq i32 %16, 3
%18 = select i1 %17, i32 6, i32 0
br label %19
19: ; preds = %15, %12, %9, %6, %3, %0
%20 = phi i32 [ 1, %0 ], [ 2, %3 ], [ 3, %6 ], [ 4, %9 ], [ 5, %12 ], [ %18, %15 ]
ret i32 %20
}