#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 */
char getchar();
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ putchar(char);
int strlen(char *);
int main() {
  char firstName[25];
  char lastName[25];
  char msg1[] = "Please enter your first name:";
  char msg2[] = "Please enter your last name:";
  char tempChar;
  int strLength;
  strLength = strlen(msg1);
  for (int ctr = 0; ctr < strLength; ctr++) {
    putchar(msg1[ctr]);
  }
  for (int ctr = 0; ctr < 25; ctr++) {
    tempChar = getchar();
    if (tempChar == '\n') {
      break;
    } else {
      firstName[ctr] = tempChar;
    }
  }
  for (int ctr = 0; ctr < strLength; ctr++) {
    putchar(msg2[ctr]);
  }
  for (int ctr = 0; ctr < 25; ctr++) {
    tempChar = getchar();
    if (tempChar == '\n') {
      break;
    } else {
      lastName[ctr] = tempChar;
    }
  }
  printf("\n\nThank you for playing! Your name is %s %s", firstName, lastName);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe9f(%rip),%eax
mov    %eax,-0x48(%rbp)
mov    0xe99(%rip),%ax
mov    %ax,-0x44(%rbp)
mov    0xe92(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xe8f(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xe8c(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe8a(%rip),%eax
mov    %eax,-0x68(%rbp)
mov    0xe85(%rip),%al
mov    %al,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    120a <main+0xca>
movslq -0x8c(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    11d3 <main+0x93>
movl   $0x0,-0x90(%rbp)
cmpl   $0x19,-0x90(%rbp)
jge    126d <main+0x12d>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x81(%rbp)
movsbl -0x81(%rbp),%eax
cmp    $0xa,%eax
jne    1243 <main+0x103>
jmp    126d <main+0x12d>
mov    -0x81(%rbp),%cl
movslq -0x90(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
jmp    1259 <main+0x119>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1214 <main+0xd4>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    12ae <main+0x16e>
movslq -0x94(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1277 <main+0x137>
movl   $0x0,-0x98(%rbp)
cmpl   $0x19,-0x98(%rbp)
jge    1311 <main+0x1d1>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x81(%rbp)
movsbl -0x81(%rbp),%eax
cmp    $0xa,%eax
jne    12e7 <main+0x1a7>
jmp    1311 <main+0x1d1>
mov    -0x81(%rbp),%cl
movslq -0x98(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
jmp    12fd <main+0x1bd>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    12b8 <main+0x178>
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    0xd1d(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
movups 0xebf(%rip),%xmm0
movups %xmm0,0xe(%rsp)
movaps 0xea5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <strlen@plt>
mov    %eax,%r14d
mov    %eax,%ebx
test   %eax,%eax
jle    1192 <main+0x52>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1180 <main+0x40>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
je     11b9 <main+0x79>
mov    %al,0x40(%rsp,%rbp,1)
add    $0x1,%rbp
cmp    $0x19,%rbp
jne    11a0 <main+0x60>
test   %r14d,%r14d
jle    11e4 <main+0xa4>
xor    %ebp,%ebp
lea    0xe59(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsbl 0x0(%rbp,%r14,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11d0 <main+0x90>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
je     1209 <main+0xc9>
mov    %al,0x20(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x19,%rbx
jne    11f0 <main+0xb0>
lea    0xe2d(%rip),%rdi
lea    0x40(%rsp),%rsi
lea    0x20(%rsp),%rdx
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.msg1 = [30 x i8] c"Please enter your first name:\00"
@__const.main.msg2 = [29 x i8] c"Please enter your last name:\00"
@.str = [44 x i8] c"\0A\0AThank you for playing! Your name is %s %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [25 x i8]
%3 = alloca [25 x i8]
%4 = alloca [30 x i8]
%5 = alloca [29 x i8]
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = bitcast [30 x i8]* %4 to i8*
%13 = bitcast [29 x i8]* %5 to i8*
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %7
store i32 0, i32* %8
br label %16
16: ; preds = %26, %0
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = call i32 @putchar(i8 signext %24)
br label %26
26: ; preds = %20
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %16
29: ; preds = %16
store i32 0, i32* %9
br label %30
30: ; preds = %45, %29
%31 = load i32, i32* %9
%32 = icmp slt i32 %31, 25
br i1 %32, label %33, label %48
33: ; preds = %30
%34 = call signext i8 (...) @getchar()
store i8 %34, i8* %6
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 10
br i1 %37, label %38, label %39
38: ; preds = %33
br label %48
39: ; preds = %33
%40 = load i8, i8* %6
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %42
store i8 %40, i8* %43
br label %44
44: ; preds = %39
br label %45
45: ; preds = %44
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
store i32 %47, i32* %9
br label %30
48: ; preds = %38, %30
store i32 0, i32* %10
br label %49
49: ; preds = %59, %48
%50 = load i32, i32* %10
%51 = load i32, i32* %7
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %62
53: ; preds = %49
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [29 x i8], [29 x i8]* %5, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = call i32 @putchar(i8 signext %57)
br label %59
59: ; preds = %53
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %49
62: ; preds = %49
store i32 0, i32* %11
br label %63
63: ; preds = %78, %62
%64 = load i32, i32* %11
%65 = icmp slt i32 %64, 25
br i1 %65, label %66, label %81
66: ; preds = %63
%67 = call signext i8 (...) @getchar()
store i8 %67, i8* %6
%68 = load i8, i8* %6
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 10
br i1 %70, label %71, label %72
71: ; preds = %66
br label %81
72: ; preds = %66
%73 = load i8, i8* %6
%74 = load i32, i32* %11
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 %75
store i8 %73, i8* %76
br label %77
77: ; preds = %72
br label %78
78: ; preds = %77
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %63
81: ; preds = %71, %63
%82 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%83 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%84 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %82, i8* %83)
ret i32 0
}

LLVM IR (-O2):
@__const.main.msg1 = [30 x i8] c"Please enter your first name:\00"
@__const.main.msg2 = [29 x i8] c"Please enter your last name:\00"
@.str = [44 x i8] c"\0A\0AThank you for playing! Your name is %s %s\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = alloca [25 x i8]
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%7 = call i32 @strlen(i8* %6)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %0
%10 = zext i32 %7 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %16, %11 ]
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = call i32 @putchar(i8 signext %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %0
br label %19
19: ; preds = %18, %23
%20 = phi i64 [ %25, %23 ], [ 0, %18 ]
%21 = call signext i8 (...) @getchar()
%22 = icmp eq i8 %21, 10
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %20
store i8 %21, i8* %24
%25 = add nuw nsw i64 %20, 1
%26 = icmp eq i64 %25, 25
br i1 %26, label %27, label %19
27: ; preds = %19, %23
br i1 %8, label %28, label %37
28: ; preds = %27
%29 = zext i32 %7 to i64
br label %30
30: ; preds = %28, %30
%31 = phi i64 [ 0, %28 ], [ %35, %30 ]
%32 = getelementptr inbounds [29 x i8], [29 x i8]* @__const.main.msg2, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = call i32 @putchar(i8 signext %33)
%35 = add nuw nsw i64 %31, 1
%36 = icmp eq i64 %35, %29
br i1 %36, label %37, label %30
37: ; preds = %30, %27
br label %38
38: ; preds = %37, %42
%39 = phi i64 [ %44, %42 ], [ 0, %37 ]
%40 = call signext i8 (...) @getchar()
%41 = icmp eq i8 %40, 10
br i1 %41, label %46, label %42
42: ; preds = %38
%43 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %39
store i8 %40, i8* %43
%44 = add nuw nsw i64 %39, 1
%45 = icmp eq i64 %44, 25
br i1 %45, label %46, label %38
46: ; preds = %38, %42
%47 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5)
ret i32 0
}