#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 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 if (x == -2) {
    printf("message length longer than 10 characters\n");
  } 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    115c <main+0x3c>
lea    -0x12(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <main+0xbc>
cmpl   $0x1,-0x8(%rbp)
jne    117d <main+0x5d>
lea    -0x12(%rbp),%rsi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d7 <main+0xb7>
cmpl   $0xffffffff,-0x8(%rbp)
jne    119e <main+0x7e>
lea    -0x12(%rbp),%rsi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d2 <main+0xb2>
cmpl   $0xfffffffe,-0x8(%rbp)
jne    11bb <main+0x9b>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cd <main+0xad>
lea    -0x12(%rbp),%rsi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d2 <main+0xb2>
jmp    11d7 <main+0xb7>
jmp    11dc <main+0xbc>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xe(%rsp),%rdi
call   1050 <readinput@plt>
add    $0x2,%eax
cmp    $0x3,%eax
ja     115f <main+0x2f>
lea    0xeb3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf34(%rip),%rdi
jmp    1166 <main+0x36>
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
jmp    1192 <main+0x62>
lea    0xedb(%rip),%rdi
jmp    1186 <main+0x56>
lea    0xe93(%rip),%rdi
jmp    1186 <main+0x56>
lea    0xeaa(%rip),%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1040 <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 = [42 x i8] c"message length longer than 10 characters\0A\00"
@.str.4 = [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 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %34
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 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %33
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 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %32
23: ; preds = %17
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, -2
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
br label %31
28: ; preds = %23
%29 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28, %26
br label %32
32: ; preds = %31, %20
br label %33
33: ; preds = %32, %14
br label %34
34: ; preds = %33, %8
%35 = load i32, i32* %1
ret i32 %35
}

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 = [30 x i8] c"abort: something is not right\00"
@str.5 = [41 x i8] c"message length longer than 10 characters\00"
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)
switch i32 %3, label %12 [
i32 0, label %4
i32 1, label %6
i32 -1, label %8
i32 -2, label %10
]
4: ; preds = %0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %14
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %14
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %14
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.5, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %6, %10, %12, %8, %4
ret i32 0
}