#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strip_newline(char *, int);
char *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, "Alex") == 0) {
    printf("That's my name too.\n");
  } else {
    printf("That's not my name.\n");
  }
  printf("Your name is %ld letters long\n", strlen(name));
  printf("Enter your last name: ");
  fgets(lastname, 50, stdin);
  strip_newline(lastname, 50);
  fullname[0] = '\0';
  strcat(fullname, name);
  strcat(fullname, " ");
  strcat(fullname, lastname);
  printf("Your full name is %s\n", fullname);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    0x2e4d(%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    0xe59(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11e2 <main+0x72>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11f0 <main+0x80>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    0x2dc5(%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   1090 <strcat@plt>
lea    -0xf0(%rbp),%rdi
lea    0xdb5(%rip),%rsi
call   1090 <strcat@plt>
lea    -0xf0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1090 <strcat@plt>
lea    -0xf0(%rbp),%rsi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf0,%rsp
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2e47(%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    0xe4d(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
lea    0xea0(%rip),%rax
lea    0xe85(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0xe21(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%edx
lea    0x70(%rsp),%r15
mov    %r15,%rdi
mov    $0x32,%esi
call   1070 <fgets@plt>
mov    %r15,%rdi
mov    $0x32,%esi
call   1030 <strip_newline@plt>
movb   $0x0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <strcat@plt>
lea    0xdc8(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10a0 <strcat@plt>
lea    0xdeb(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Please enter your name: \00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"Alex\00"
@.str.2 = [21 x i8] c"That's my name too.\0A\00"
@.str.3 = [21 x i8] c"That's not my name.\0A\00"
@.str.4 = [31 x i8] c"Your name is %ld letters long\0A\00"
@.str.5 = [23 x i8] c"Enter your last name: \00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [22 x i8] c"Your full name is %s\0A\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 ([5 x i8], [5 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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 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 i8* @strlen(i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %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 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%36 = call i32 @strcat(i8* %34, i8* %35)
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %37)
%39 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Please enter your name: \00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"Alex\00"
@.str.4 = [31 x i8] c"Your name is %ld letters long\0A\00"
@.str.5 = [23 x i8] c"Enter your last name: \00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [22 x i8] c"Your full name is %s\0A\00"
@str = [20 x i8] c"That's not my name.\00"
@str.8 = [20 x i8] c"That's 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 ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0)
%14 = call i32 @puts(i8* dereferenceable(1) %13)
%15 = call i8* @strlen(i8* %4)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %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))
%23 = call i32 @strcat(i8* %6, i8* %5)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %6)
%25 = call i32 (...) @getchar()
ret i32 0
}