#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*/ getchar();
int /*<<< orphan*/ puts(char *);
scalar_t__ s_gets(char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int main(void) {
  char flower[80];
  char addon[] = "s smell like old shoes.";
  puts("What is your favorite flower?");
  if (s_gets(flower, 80)) {
    strcat(flower, addon);
    puts(flower);
    puts(addon);
  } else
    puts("End of file encountered!");
  puts("bye");
  getchar();
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1040 <s_gets@plt>
cmp    $0x0,%rax
je     11bb <main+0x7b>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x60(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x80(%rbp),%rdi
call   1030 <puts@plt>
jmp    11c7 <main+0x87>
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x2e73656f687320,%rax
mov    %rax,0x10(%rsp)
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rdi
mov    $0x50,%esi
call   1040 <s_gets@plt>
test   %rax,%rax
je     11a1 <main+0x61>
lea    0x20(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
jmp    11a8 <main+0x68>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.addon = [24 x i8] c"s smell like old shoes.\00"
@.str = [30 x i8] c"What is your favorite flower?\00"
@.str.1 = [25 x i8] c"End of file encountered!\00"
@.str.2 = [4 x i8] c"bye\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [24 x i8]
store i32 0, i32* %1
%4 = bitcast [24 x i8]* %3 to i8*
%5 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%7 = call i64 @s_gets(i8* %6, i32 80)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [24 x i8], [24 x i8]* %3, i64 0, i64 0
%12 = call i32 @strcat(i8* %10, i8* %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i32 @puts(i8* %13)
%15 = getelementptr inbounds [24 x i8], [24 x i8]* %3, i64 0, i64 0
%16 = call i32 @puts(i8* %15)
br label %19
17: ; preds = %0
%18 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %9
%20 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 (...) @getchar()
%22 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.addon = [24 x i8] c"s smell like old shoes.\00"
@.str = [30 x i8] c"What is your favorite flower?\00"
@.str.1 = [25 x i8] c"End of file encountered!\00"
@.str.2 = [4 x i8] c"bye\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [24 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = call i64 @s_gets(i8* %3, i32 80)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %0
%9 = call i32 @strcat(i8* %3, i8* %4)
%10 = call i32 @puts(i8* %3)
%11 = call i32 @puts(i8* %4)
br label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (...) @getchar()
%17 = call i32 (...) @getchar()
ret i32 0
}