#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*/ printPass(int);
int assignEconomySeat(int seats[]) {
  int seatAssigned = 0;
  int i;
  for (i = 5; i < 10; i++) {
    if (seats[i] == 0) {
      seats[i] = 1;
      seatAssigned = 1;
      printPass(i);
      break;
    }
  }
  return seatAssigned;
}


x86 assembly (clang, -O0):
<assignEconomySeat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x5,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    117c <assignEconomySeat+0x6c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1169 <assignEconomySeat+0x59>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
movl   $0x1,-0xc(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <printPass@plt>
jmp    117c <assignEconomySeat+0x6c>
jmp    116e <assignEconomySeat+0x5e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <assignEconomySeat+0x1a>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assignEconomySeat>:
push   %rax
cmpl   $0x0,0x14(%rdi)
je     1133 <assignEconomySeat+0x23>
cmpl   $0x0,0x18(%rdi)
je     113a <assignEconomySeat+0x2a>
cmpl   $0x0,0x1c(%rdi)
je     1141 <assignEconomySeat+0x31>
cmpl   $0x0,0x20(%rdi)
je     1148 <assignEconomySeat+0x38>
xor    %eax,%eax
cmpl   $0x0,0x24(%rdi)
je     114f <assignEconomySeat+0x3f>
pop    %rcx
ret
mov    $0x5,%eax
jmp    1154 <assignEconomySeat+0x44>
mov    $0x6,%eax
jmp    1154 <assignEconomySeat+0x44>
mov    $0x7,%eax
jmp    1154 <assignEconomySeat+0x44>
mov    $0x8,%eax
jmp    1154 <assignEconomySeat+0x44>
mov    $0x9,%eax
mov    %eax,%ecx
movl   $0x1,(%rdi,%rcx,4)
mov    %eax,%edi
call   1030 <printPass@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @assignEconomySeat(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 5, i32* %4
br label %5
5: ; preds = %23, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %8
%16 = load i32*, i32** %2
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 1, i32* %19
store i32 1, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @printPass(i32 %20)
br label %26
22: ; preds = %8
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %5
26: ; preds = %15, %5
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @assignEconomySeat(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 5
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %22, %18, %14, %10, %1
%6 = phi i32 [ 5, %1 ], [ 6, %10 ], [ 7, %14 ], [ 8, %18 ], [ 9, %22 ]
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 1, i32* %8
%9 = tail call i32 @printPass(i32 %6)
br label %26
10: ; preds = %1
%11 = getelementptr inbounds i32, i32* %0, i64 6
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %10
%15 = getelementptr inbounds i32, i32* %0, i64 7
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %5, label %18
18: ; preds = %14
%19 = getelementptr inbounds i32, i32* %0, i64 8
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %5, label %22
22: ; preds = %18
%23 = getelementptr inbounds i32, i32* %0, i64 9
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %5, label %26
26: ; preds = %22, %5
%27 = phi i32 [ 1, %5 ], [ 0, %22 ]
ret i32 %27
}