#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strip_newline(char *, int);
int strlen(char *);
int main() {
  char name[50];
  char lastname[50];
  char fullname[100];
  printf("Please enter your name: ");
  fgets(name, 50, stdin);
  strip_newline(name, 50);
  if (strcmp(name, "Chicken") == 0) {
    printf("Thats my name too \n");
  } else {
    printf("We don't have the same name\n");
  }
  printf("Your name is %d letters long", strlen(name));
  printf("Enter your last name: ");
  fgets(lastname, 50, stdin);
  strip_newline(lastname, 50);
  fullname[0] = '\0';
  strcat(fullname, name);
  strcat(fullname, " ");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    0x2e5d(%rip),%rax
mov    (%rax),%edx
mov    $0x32,%esi
call   1060 <fgets@plt>
lea    -0x40(%rbp),%rdi
mov    $0x32,%esi
call   1030 <strip_newline@plt>
lea    -0x40(%rbp),%rdi
lea    0xe69(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11d2 <main+0x72>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11e0 <main+0x80>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    0x2dd6(%rip),%rax
mov    (%rax),%edx
mov    $0x32,%esi
call   1060 <fgets@plt>
lea    -0x80(%rbp),%rdi
mov    $0x32,%esi
call   1030 <strip_newline@plt>
movb   $0x0,-0xf0(%rbp)
lea    -0xf0(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0xf0(%rbp),%rdi
lea    0xdc6(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xe8,%rsp
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2e59(%rip),%rbx
mov    (%rbx),%edx
lea    0xb0(%rsp),%r14
mov    %r14,%rdi
mov    $0x32,%esi
call   1070 <fgets@plt>
mov    %r14,%rdi
mov    $0x32,%esi
call   1030 <strip_newline@plt>
lea    0xe5f(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
lea    0xea5(%rip),%rax
lea    0xe82(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0xe36(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%edx
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x32,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1030 <strip_newline@plt>
movb   $0x0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <strcat@plt>
lea    0xddb(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcat@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Please enter your name: \00"
@stdin = global i32 0
@.str.1 = [8 x i8] c"Chicken\00"
@.str.2 = [20 x i8] c"Thats my name too \0A\00"
@.str.3 = [29 x i8] c"We don't have the same name\0A\00"
@.str.4 = [29 x i8] c"Your name is %d letters long\00"
@.str.5 = [23 x i8] c"Enter your last name: \00"
@.str.6 = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [100 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 50, i32 %7)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%10 = call i32 @strip_newline(i8* %9, i32 50)
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%24 = load i32, i32* @stdin
%25 = call i32 @fgets(i8* %23, i32 50, i32 %24)
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%27 = call i32 @strip_newline(i8* %26, i32 50)
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
store i8 0, i8* %28
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%31 = call i32 @strcat(i8* %29, i8* %30)
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%33 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [25 x i8] c"Please enter your name: \00"
@stdin = global i32 0
@.str.1 = [8 x i8] c"Chicken\00"
@.str.4 = [29 x i8] c"Your name is %d letters long\00"
@.str.5 = [23 x i8] c"Enter your last name: \00"
@.str.6 = [2 x i8] c" \00"
@str = [28 x i8] c"We don't have the same name\00"
@str.7 = [19 x i8] c"Thats my name too \00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %4, i32 50, i32 %8)
%10 = call i32 @strip_newline(i8* %4, i32 50)
%11 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0)
%14 = call i32 @puts(i8* dereferenceable(1) %13)
%15 = call i32 @strlen(i8* %4)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %5, i32 50, i32 %18)
%20 = call i32 @strip_newline(i8* %5, i32 50)
store i8 0, i8* %6
%21 = call i32 @strcat(i8* %6, i8* %4)
%22 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}