#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 *, char *);
int readinput(char *);
main() {
  int x;
  char c[10];
  x = readinput(c);
  if (x == 0) {
    printf("client says %s which means yes\n", c);
  } else if (x == 1) {
    printf("client says %s which means no\n", c);
  } else if (x == -1) {
    printf("can't translate client response %s\n", c);
  } else {
    printf("abort: something is not right\n", c);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x12(%rbp),%rdi
call   1040 <readinput@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115a <main+0x3a>
lea    -0x12(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <main+0x92>
cmpl   $0x1,-0x8(%rbp)
jne    1179 <main+0x59>
lea    -0x12(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
jmp    11ad <main+0x8d>
cmpl   $0xffffffff,-0x8(%rbp)
jne    1198 <main+0x78>
lea    -0x12(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
jmp    11a8 <main+0x88>
lea    -0x12(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
jmp    11ad <main+0x8d>
jmp    11b2 <main+0x92>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xe(%rsp),%rdi
call   1040 <readinput@plt>
add    $0x1,%eax
cmp    $0x2,%eax
ja     1148 <main+0x28>
cltq
lea    0xf45(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    114f <main+0x2f>
lea    0xf14(%rip),%rdi
lea    0xe(%rsp),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"client says %s which means yes\0A\00"
@.str.1 = [31 x i8] c"client says %s which means no\0A\00"
@.str.2 = [36 x i8] c"can't translate client response %s\0A\00"
@.str.3 = [31 x i8] c"abort: something is not right\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = call i32 @readinput(i8* %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %28
11: ; preds = %0
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %27
17: ; preds = %11
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %26
23: ; preds = %17
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %14
br label %28
28: ; preds = %27, %8
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [32 x i8] c"client says %s which means yes\0A\00"
@.str.1 = [31 x i8] c"client says %s which means no\0A\00"
@.str.2 = [36 x i8] c"can't translate client response %s\0A\00"
@.str.3 = [31 x i8] c"abort: something is not right\0A\00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([36 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([32 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([31 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @readinput(i8* %2)
%4 = add i32 %3, 1
%5 = icmp ult i32 %4, 3
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %8)
br label %10
10: ; preds = %0, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), %0 ]
%12 = call i32 @printf(i8* %11, i8* %2)
ret i32 0
}