#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 *, int);
void showEmptySeats(int seats[], int arrayLength) {
  int emptySeats = 0;
  int i;
  for (i = 0; i < arrayLength; i++) {
    if (seats[i] == 0) {
      emptySeats++;
      printf("Seat number %d is empty\n", i + 1);
    }
  }
  printf("There are %d empty seats\n", emptySeats);
}


x86 assembly (clang, -O0):
<showEmptySeats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1179 <showEmptySeats+0x69>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1166 <showEmptySeats+0x56>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    116b <showEmptySeats+0x5b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <showEmptySeats+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showEmptySeats>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
jle    1159 <showEmptySeats+0x49>
mov    %rdi,%r12
mov    %esi,%ebx
xor    %ebp,%ebp
lea    0xed6(%rip),%r15
xor    %r14d,%r14d
jmp    1147 <showEmptySeats+0x37>
nop
add    $0x1,%r14d
add    $0x1,%rbp
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
cmp    %rbx,%rbp
je     115c <showEmptySeats+0x4c>
cmpl   $0x0,(%r12,%rbp,4)
je     1130 <showEmptySeats+0x20>
add    $0x1,%rbp
cmp    %rbx,%rbp
jne    1147 <showEmptySeats+0x37>
jmp    115c <showEmptySeats+0x4c>
xor    %r14d,%r14d
lea    0xeb6(%rip),%rdi
mov    %r14d,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Seat number %d is empty\0A\00"
@.str.1 = [26 x i8] c"There are %d empty seats\0A\00"
define void @showEmptySeats(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %28
11: ; preds = %7
%12 = load i32*, i32** %3
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %11
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
%23 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %18, %11
br label %25
25: ; preds = %24
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %7
28: ; preds = %7
%29 = load i32, i32* %5
%30 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %29)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Seat number %d is empty\0A\00"
@.str.1 = [26 x i8] c"There are %d empty seats\0A\00"
define void @showEmptySeats(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %23
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %19
%7 = phi i64 [ 0, %4 ], [ %20, %19 ]
%8 = phi i32 [ 0, %4 ], [ %21, %19 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %7
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %6
%13 = add nuw nsw i64 %7, 1
br label %19
14: ; preds = %6
%15 = add nsw i32 %8, 1
%16 = add nuw nsw i64 %7, 1
%17 = trunc i64 %16 to i32
%18 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %12, %14
%20 = phi i64 [ %13, %12 ], [ %16, %14 ]
%21 = phi i32 [ %8, %12 ], [ %15, %14 ]
%22 = icmp eq i64 %20, %5
br i1 %22, label %23, label %6
23: ; preds = %19, %2
%24 = phi i32 [ 0, %2 ], [ %21, %19 ]
%25 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret void
}