#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(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, double *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, double);
int main(void) {
  char first[20];
  char last[20];
  char formal[2 * 20 + 10];
  double prize;
  puts("Enter your first name: ");
  gets(first);
  puts("Enter your last name: ");
  gets(last);
  puts("Enter your prize money: ");
  scanf("%lf", &prize);
  sprintf(formal, "%s, %-19s: $%6.2f\n", last, first, prize);
  puts(formal);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
lea    -0x20(%rbp),%rdi
call   1040 <gets@plt>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    -0x40(%rbp),%rdi
call   1040 <gets@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    -0x88(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x80(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x20(%rbp),%rcx
movsd  -0x88(%rbp),%xmm0
ff
lea    0xe96(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
call   1040 <gets@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
call   1040 <gets@plt>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb7(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xea4(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter your first name: \00"
@.str.1 = [23 x i8] c"Enter your last name: \00"
@.str.2 = [25 x i8] c"Enter your prize money: \00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [19 x i8] c"%s, %-19s: $%6.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca [50 x i8]
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
%9 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%11 = call i32 @gets(i8* %10)
%12 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %5)
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%17 = load double, double* %5
%18 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %15, i8* %16, double %17)
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%20 = call i32 @puts(i8* %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter your first name: \00"
@.str.1 = [23 x i8] c"Enter your last name: \00"
@.str.2 = [25 x i8] c"Enter your prize money: \00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [19 x i8] c"%s, %-19s: $%6.2f\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [50 x i8]
%4 = alloca double
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = bitcast double* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @gets(i8* %5)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @gets(i8* %6)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %4)
%15 = load double, double* %4
%16 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %6, i8* %5, double %15)
%17 = call i32 @puts(i8* %7)
ret i32 0
}