#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 parseXYeZ(char *);
int /*<<< orphan*/ printf(char *, int);
int safePosition(int);
int /*<<< orphan*/ scanf(char *, char **);
int main() {
  int persons = 0;
  char xyez[4];
  scanf("%s", &xyez);
  while ((persons = parseXYeZ(xyez)) > 0) {
    printf("%d\n", safePosition(persons));
    scanf("%s", &xyez);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0xc(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1060 <scanf@plt>
lea    -0xc(%rbp),%rdi
call   1030 <parseXYeZ@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11a6 <main+0x66>
mov    -0x8(%rbp),%edi
call   1050 <safePosition@plt>
mov    %eax,%esi
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xe64(%rip),%rdi
call   1060 <scanf@plt>
jmp    1166 <main+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <parseXYeZ@plt>
test   %eax,%eax
jle    11a8 <main+0x68>
lea    0xe93(%rip),%r14
lea    0xe89(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %eax,%edi
call   1050 <safePosition@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <parseXYeZ@plt>
test   %eax,%eax
jg     1180 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%4 = bitcast [4 x i8]* %3 to i8**
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %4)
br label %6
6: ; preds = %10, %0
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%8 = call i32 @parseXYeZ(i8* %7)
store i32 %8, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @safePosition(i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = bitcast [4 x i8]* %3 to i8**
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %14)
br label %6
16: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [4 x i8]
%2 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%3 = bitcast [4 x i8]* %1 to i8**
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %3)
%5 = call i32 @parseXYeZ(i8* %2)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %0, %7
%8 = phi i32 [ %12, %7 ], [ %5, %0 ]
%9 = call i32 @safePosition(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %3)
%12 = call i32 @parseXYeZ(i8* %2)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %7, label %14
14: ; preds = %7, %0
ret i32 0
}