#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*/ gets_s(char *, int);
int /*<<< orphan*/ printf(char *, ...);
void GetInputWithGets() {
  char firstname[5];
  char lastname[5];
  printf("Enter your first name:");
  gets_s(firstname, 5);
  printf("Enter your last name:");
  gets_s(lastname, 5);
  printf("Hello, %s, %s\n", firstname, lastname);
}


x86 assembly (clang, -O0):
<GetInputWithGets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x5(%rbp),%rdi
mov    $0x5,%esi
call   1040 <gets_s@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa(%rbp),%rdi
mov    $0x5,%esi
call   1040 <gets_s@plt>
lea    -0x5(%rbp),%rsi
lea    -0xa(%rbp),%rdx
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetInputWithGets>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x13(%rsp),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <gets_s@plt>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <gets_s@plt>
lea    0xebf(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter your first name:\00"
@.str.1 = [22 x i8] c"Enter your last name:\00"
@.str.2 = [15 x i8] c"Hello, %s, %s\0A\00"
define void @GetInputWithGets() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%5 = call i32 @gets_s(i8* %4, i32 5)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%8 = call i32 @gets_s(i8* %7, i32 5)
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter your first name:\00"
@.str.1 = [22 x i8] c"Enter your last name:\00"
@.str.2 = [15 x i8] c"Hello, %s, %s\0A\00"
define void @GetInputWithGets() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets_s(i8* %3, i32 5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @gets_s(i8* %4, i32 5)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* %4)
ret void
}