#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 *, char *);
int main(void) {
  char name[50], food[50], color[50], yesno[50];
  printf("Hello. What's your name? ");
  scanf("%50s", name);
  printf("Hello %s. What is your favorite food? ", name);
  scanf("%50s", food);
  printf("Oh, I like %s too. And what is your favorite color? ", food);
  scanf("%50s", color);
  printf("So, %s, would you like %s %s? ", name, color, food);
  scanf("%50s", yesno);
  if (yesno[0] == 'y' || yesno[0] == 'Y')
    printf("I knew you would.\n");
  else
    printf("That's too bad.\n");
  printf("Well %s, good bye for now.\n", name);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xecf(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x40(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x80(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc0(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x40(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x100(%rbp),%rsi
lea    0xe58(%rip),%rdi
call   1040 <scanf@plt>
movsbl -0x100(%rbp),%eax
cmp    $0x79,%eax
je     11e7 <main+0xc7>
movsbl -0x100(%rbp),%eax
cmp    $0x59,%eax
jne    11fa <main+0xda>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1208 <main+0xe8>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xf8,%rsp
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec7(%rip),%r15
lea    0xc0(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0xeb2(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x80(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
lea    0xeb5(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x40(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xec9(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%al
and    $0xdf,%al
cmp    $0x59,%al
lea    0xeeb(%rip),%rax
lea    0xed4(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Hello. What's your name? \00"
@.str.1 = [5 x i8] c"%50s\00"
@.str.2 = [39 x i8] c"Hello %s. What is your favorite food? \00"
@.str.3 = [53 x i8] c"Oh, I like %s too. And what is your favorite color? \00"
@.str.4 = [31 x i8] c"So, %s, would you like %s %s? \00"
@.str.5 = [19 x i8] c"I knew you would.\0A\00"
@.str.6 = [17 x i8] c"That's too bad.\0A\00"
@.str.7 = [28 x i8] c"Well %s, good bye for now.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca [50 x i8]
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %17, i8* %18, i8* %19)
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%22 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 121
br i1 %26, label %32, label %27
27: ; preds = %0
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 89
br i1 %31, label %32, label %34
32: ; preds = %27, %0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %36
34: ; preds = %27
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
%37 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Hello. What's your name? \00"
@.str.1 = [5 x i8] c"%50s\00"
@.str.2 = [39 x i8] c"Hello %s. What is your favorite food? \00"
@.str.3 = [53 x i8] c"Oh, I like %s too. And what is your favorite color? \00"
@.str.4 = [31 x i8] c"So, %s, would you like %s %s? \00"
@.str.7 = [28 x i8] c"Well %s, good bye for now.\0A\00"
@str = [16 x i8] c"That's too bad.\00"
@str.8 = [18 x i8] c"I knew you would.\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%14 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %5, i8* %7, i8* %6)
%16 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%17 = load i8, i8* %8
%18 = and i8 %17, -33
%19 = icmp eq i8 %18, 89
%20 = select i1 %19, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %5)
ret i32 0
}