#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 /*<<< orphan*/ scanf(char *, int *);
void cancelSpecific(int layout[], int maxSeats) {
  int seat;
  printf("\nDoste arithmo thesis: ");
  scanf("%d", &seat);
  if (seat <= maxSeats) {
    if (layout[seat - 1]) {
      layout[seat - 1] = 0;
      printf("H thesi akyrothike\n");
    } else {
      printf("H thesi DEN einai kratimeni, epilexte allh!\n");
    }
  } else {
    printf("Prepei na dosete enan egkyro arithmo thesis (Max = %d)\n",
           maxSeats);
  }
}


x86 assembly (clang, -O0):
<cancelSpecific>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11aa <cancelSpecific+0x8a>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1197 <cancelSpecific+0x77>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <cancelSpecific+0x85>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <cancelSpecific+0x9b>
mov    -0xc(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cancelSpecific>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0x4(%rsp),%rax
cmp    %ebx,%eax
jle    1173 <cancelSpecific+0x43>
lea    0xeb3(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1199 <cancelSpecific+0x69>
cmpl   $0x0,-0x4(%r14,%rax,4)
je     118d <cancelSpecific+0x5d>
movl   $0x0,-0x4(%r14,%rax,4)
lea    0xef4(%rip),%rdi
jmp    1194 <cancelSpecific+0x64>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [24 x i8] c"\0ADoste arithmo thesis: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"H thesi akyrothike\0A\00"
@.str.3 = [45 x i8] c"H thesi DEN einai kratimeni, epilexte allh!\0A\00"
@.str.4 = [56 x i8] c"Prepei na dosete enan egkyro arithmo thesis (Max = %d)\0A\00"
define void @cancelSpecific(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %29
11: ; preds = %2
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %12, i64 %15
%17 = load i32, i32* %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %11
%20 = load i32*, i32** %3
%21 = load i32, i32* %5
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %20, i64 %23
store i32 0, i32* %24
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %28
26: ; preds = %11
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %26, %19
br label %32
29: ; preds = %2
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %28
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0ADoste arithmo thesis: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [56 x i8] c"Prepei na dosete enan egkyro arithmo thesis (Max = %d)\0A\00"
@str = [44 x i8] c"H thesi DEN einai kratimeni, epilexte allh!\00"
@str.5 = [19 x i8] c"H thesi akyrothike\00"
define void @cancelSpecific(i32* nocapture %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, %1
br i1 %8, label %19, label %9
9: ; preds = %2
%10 = add nsw i32 %7, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %9
store i32 0, i32* %12
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
br label %21
17: ; preds = %9
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %21
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i32 %1)
br label %21
21: ; preds = %15, %17, %19
ret void
}