#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__ isWindow(int, int);
int /*<<< orphan*/ printf(char *, ...);
void showReserved(int layout[], int maxSeats) {
  int i, c = 0;
  printf("\nKratimenes theseis\n");
  printf("------------------\n");
  for (i = 0; i < maxSeats; i++) {
    if (layout[i]) {
      c++;
      printf("Thesi %d: ", c);
      if (isWindow(maxSeats, i + 1)) {
        printf("[%d]", i + 1);
      } else {
        printf("%d", i + 1);
      }
      printf("\n");
    }
  }
  if (!c) {
    printf("Den yparxei kamia kratimeni thesi!\n");
  }
}


x86 assembly (clang, -O0):
<showReserved>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f7 <showReserved+0xd7>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11e4 <showReserved+0xc4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
add    $0x1,%esi
call   1030 <isWindow@plt>
cmp    $0x0,%rax
je     11c2 <showReserved+0xa2>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d6 <showReserved+0xb6>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e9 <showReserved+0xc9>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <showReserved+0x39>
cmpl   $0x0,-0x14(%rbp)
jne    120f <showReserved+0xef>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showReserved>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r12
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    11ed <showReserved+0xad>
mov    %r15d,%r13d
lea    0xe93(%rip),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11ca <showReserved+0x8a>
xchg   %ax,%ax
add    $0x1,%ebp
lea    0xe76(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
mov    %r15d,%edi
mov    %ebx,%esi
call   1050 <isWindow@plt>
test   %rax,%rax
mov    %r14,%rdi
lea    0xe62(%rip),%rax
cmove  %rax,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    %r13,%rbx
je     11da <showReserved+0x9a>
cmpl   $0x0,(%r12,%rbx,4)
jne    1180 <showReserved+0x40>
add    $0x1,%rbx
cmp    %r13,%rbx
jne    11ca <showReserved+0x8a>
test   %ebp,%ebp
je     11ed <showReserved+0xad>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe46(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"\0AKratimenes theseis\0A\00"
@.str.1 = [20 x i8] c"------------------\0A\00"
@.str.2 = [11 x i8] c"Thesi %d: \00"
@.str.3 = [5 x i8] c"[%d]\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [36 x i8] c"Den yparxei kamia kratimeni thesi!\0A\00"
define void @showReserved(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* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %9
9: ; preds = %41, %2
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %44
13: ; preds = %9
%14 = load i32*, i32** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %40
20: ; preds = %13
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
%28 = call i64 @isWindow(i32 %25, i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %20
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %38
34: ; preds = %20
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %34, %30
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %40
40: ; preds = %38, %13
br label %41
41: ; preds = %40
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %9
44: ; preds = %9
%45 = load i32, i32* %6
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %44
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
ret void
}

LLVM IR (-O2):
@.str.2 = [11 x i8] c"Thesi %d: \00"
@.str.3 = [5 x i8] c"[%d]\00"
@.str.4 = [3 x i8] c"%d\00"
@str = [20 x i8] c"\0AKratimenes theseis\00"
@str.7 = [19 x i8] c"------------------\00"
@str.8 = [35 x i8] c"Den yparxei kamia kratimeni thesi!\00"
define void @showReserved(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0))
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %32
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %26
%9 = phi i64 [ 0, %6 ], [ %27, %26 ]
%10 = phi i32 [ 0, %6 ], [ %28, %26 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %9
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = add nuw nsw i64 %9, 1
br label %26
16: ; preds = %8
%17 = add nsw i32 %10, 1
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = add nuw nsw i64 %9, 1
%20 = trunc i64 %19 to i32
%21 = tail call i64 @isWindow(i32 %1, i32 %20)
%22 = icmp eq i64 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %23, i32 %20)
%25 = tail call i32 @putchar(i32 10)
br label %26
26: ; preds = %14, %16
%27 = phi i64 [ %15, %14 ], [ %19, %16 ]
%28 = phi i32 [ %10, %14 ], [ %17, %16 ]
%29 = icmp eq i64 %27, %7
br i1 %29, label %30, label %8
30: ; preds = %26
%31 = icmp eq i32 %28, 0
br i1 %31, label %32, label %34
32: ; preds = %2, %30
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
ret void
}