#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*/ free(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char **, char **);
int strlen(char *);
int main() {
  char *firstName;
  char *lastName;
  scanf("%ms %ms", &firstName, &lastName);
  printf("%s, %s", lastName, firstName);
  printf("Size firstName: %d, size lastname: %d\n", strlen(firstName),
         strlen(lastName));
  free(firstName);
  free(lastName);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <scanf@plt>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
mov    (%rsp),%rdi
call   1040 <strlen@plt>
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%ms %ms\00"
@.str.1 = [7 x i8] c"%s, %s\00"
@.str.2 = [39 x i8] c"Size firstName: %d, size lastname: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2, i8** %3)
%5 = load i8*, i8** %3
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %6)
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %11)
%13 = load i8*, i8** %2
%14 = call i32 @free(i8* %13)
%15 = load i8*, i8** %3
%16 = call i32 @free(i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%ms %ms\00"
@.str.1 = [7 x i8] c"%s, %s\00"
@.str.2 = [39 x i8] c"Size firstName: %d, size lastname: %d\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = bitcast i8** %1 to i8*
%4 = bitcast i8** %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %1, i8** %2)
%6 = load i8*, i8** %2
%7 = load i8*, i8** %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %7)
%9 = load i8*, i8** %1
%10 = call i32 @strlen(i8* %9)
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %12)
%14 = load i8*, i8** %1
%15 = call i32 @free(i8* %14)
%16 = load i8*, i8** %2
%17 = call i32 @free(i8* %16)
ret i32 0
}