#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 */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *, char *);
int main() {
  clock_t begin, end;
  double time_spent;
  begin = clock();
  char *firstName, *lastName;
  firstName = malloc(30);
  lastName = malloc(30);
  scanf("%29s %29s", firstName, lastName);
  printf("%s %s\n", lastName, firstName);
  free(firstName);
  free(lastName);
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("%.3lf seconds\n", time_spent);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1e,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x1e,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe6b(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e07(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe1b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%r14
mov    $0x1e,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    $0x1e,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe80(%rip),%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1070 <scanf@plt>
lea    0xe78(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %r14,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e23(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe41(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%29s %29s\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.2 = [15 x i8] c"%.3lf seconds\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca double
%5 = alloca i8*
%6 = alloca i8*
store i32 0, i32* %1
%7 = call i64 (...) @clock()
store i64 %7, i64* %2
%8 = call i8* @malloc(i32 30)
store i8* %8, i8** %5
%9 = call i8* @malloc(i32 30)
store i8* %9, i8** %6
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11)
%13 = load i8*, i8** %6
%14 = load i8*, i8** %5
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14)
%16 = load i8*, i8** %5
%17 = call i32 @free(i8* %16)
%18 = load i8*, i8** %6
%19 = call i32 @free(i8* %18)
%20 = call i64 (...) @clock()
store i64 %20, i64* %3
%21 = load i64, i64* %3
%22 = load i64, i64* %2
%23 = sub nsw i64 %21, %22
%24 = sitofp i64 %23 to double
%25 = load double, double* @CLOCKS_PER_SEC
%26 = fdiv double %24, %25
store double %26, double* %4
%27 = load double, double* %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%29s %29s\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.2 = [15 x i8] c"%.3lf seconds\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @clock()
%2 = tail call dereferenceable_or_null(30) i8* @malloc(i32 30)
%3 = tail call dereferenceable_or_null(30) i8* @malloc(i32 30)
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %2)
%6 = tail call i32 @free(i8* %2)
%7 = tail call i32 @free(i8* %3)
%8 = tail call i64 (...) @clock()
%9 = sub nsw i64 %8, %1
%10 = sitofp i64 %9 to double
%11 = load double, double* @CLOCKS_PER_SEC
%12 = fdiv double %10, %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %12)
ret i32 0
}