#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 */
scalar_t__ knows(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, j;
  i = 0;
  j = 1;
  while ((i < 4) || (j < 4)) {
    if (knows(i, j)) {
      i++;
      continue;
    } else {
      j++;
      if (j == 4) {
        printf("The %dth people is the celebrity!\n", i + 1);
        break;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x4,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jl     1156 <main+0x36>
cmpl   $0x4,-0xc(%rbp)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1166 <main+0x46>
jmp    11bd <main+0x9d>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <knows@plt>
cmp    $0x0,%rax
je     1189 <main+0x69>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jne    11b3 <main+0x93>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
jmp    11bd <main+0x9d>
jmp    11b8 <main+0x98>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <knows@plt>
test   %rax,%rax
jne    1148 <main+0x28>
add    $0x1,%ebp
cmp    $0x4,%ebp
jne    1130 <main+0x10>
jmp    114d <main+0x2d>
add    $0x1,%ebx
jmp    1130 <main+0x10>
add    $0x1,%ebx
lea    0xea9(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"The %dth people is the celebrity!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %30, %17, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 4
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 4
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ true, %4 ], [ %9, %7 ]
br i1 %11, label %12, label %31
12: ; preds = %10
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i64 @knows(i32 %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %4
20: ; preds = %12
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
%28 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %31
29: ; preds = %20
br label %30
30: ; preds = %29
br label %4
31: ; preds = %25, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"The %dth people is the celebrity!\0A\00"
define i32 @main() {
br label %1
1: ; preds = %8, %0
%2 = phi i32 [ %9, %8 ], [ 0, %0 ]
%3 = phi i32 [ %5, %8 ], [ 1, %0 ]
br label %4
4: ; preds = %1, %10
%5 = phi i32 [ %11, %10 ], [ %3, %1 ]
%6 = tail call i64 @knows(i32 %2, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = add nuw nsw i32 %2, 1
br label %1
10: ; preds = %4
%11 = add nsw i32 %5, 1
%12 = icmp eq i32 %11, 4
br i1 %12, label %13, label %4
13: ; preds = %10
%14 = add nuw nsw i32 %2, 1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}