#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 *, ...);
int /*<<< orphan*/ reserveSpecific(int *, int, int);
void reserveFreeWindow(int layout[], int maxSeats) {
  int i;
  for (i = 0; i < maxSeats; i++) {
    if (!layout[i] && isWindow(maxSeats, i + 1)) {
      printf("\nH proti diathesimi thesi se parathyro einai h [%d]\n", i + 1);
      reserveSpecific(layout, maxSeats, i + 1);
      break;
    }
  }
  if (i >= maxSeats) {
    printf("\nDen yparxei diathesimi thesi se parathyro!\n");
  }
}


x86 assembly (clang, -O0):
<reserveFreeWindow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ba <reserveFreeWindow+0x8a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11a7 <reserveFreeWindow+0x77>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
add    $0x1,%esi
call   1040 <isWindow@plt>
cmp    $0x0,%rax
je     11a7 <reserveFreeWindow+0x77>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
call   1030 <reserveSpecific@plt>
jmp    11ba <reserveFreeWindow+0x8a>
jmp    11ac <reserveFreeWindow+0x7c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <reserveFreeWindow+0x16>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11d4 <reserveFreeWindow+0xa4>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reserveFreeWindow>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    11a9 <reserveFreeWindow+0x69>
mov    %esi,%r14d
mov    %rdi,%r15
mov    %esi,%ebx
xor    %ebp,%ebp
jmp    1169 <reserveFreeWindow+0x29>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     11a9 <reserveFreeWindow+0x69>
cmpl   $0x0,(%r15,%rbp,4)
jne    1160 <reserveFreeWindow+0x20>
lea    0x1(%rbp),%esi
mov    %ebx,%edi
call   1050 <isWindow@plt>
test   %rax,%rax
je     1160 <reserveFreeWindow+0x20>
add    $0x1,%ebp
lea    0xe77(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <reserveSpecific@plt>
lea    0xe85(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"\0AH proti diathesimi thesi se parathyro einai h [%d]\0A\00"
@.str.1 = [45 x i8] c"\0ADen yparxei diathesimi thesi se parathyro!\0A\00"
define void @reserveFreeWindow(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %33, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %36
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %32, label %17
17: ; preds = %10
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = call i64 @isWindow(i32 %18, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %32
23: ; preds = %17
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i32*, i32** %3
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
%31 = call i32 @reserveSpecific(i32* %27, i32 %28, i32 %30)
br label %36
32: ; preds = %17, %10
br label %33
33: ; preds = %32
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %6
36: ; preds = %23, %6
%37 = load i32, i32* %5
%38 = load i32, i32* %4
%39 = icmp sge i32 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %42
42: ; preds = %40, %36
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"\0AH proti diathesimi thesi se parathyro einai h [%d]\0A\00"
@str = [44 x i8] c"\0ADen yparxei diathesimi thesi se parathyro!\00"
define void @reserveFreeWindow(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %22
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %20
%7 = phi i64 [ 0, %4 ], [ %11, %20 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i64 %7, 1
br i1 %10, label %12, label %20
12: ; preds = %6
%13 = trunc i64 %11 to i32
%14 = tail call i64 @isWindow(i32 %1, i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = trunc i64 %11 to i32
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = tail call i32 @reserveSpecific(i32* %0, i32 %1, i32 %17)
br label %24
20: ; preds = %6, %12
%21 = icmp eq i64 %11, %5
br i1 %21, label %22, label %6
22: ; preds = %20, %2
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %16, %22
ret void
}