#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*/ printf(char *, ...);
int scanf(char *, ...);
int main(void) {
  int age, items_read;
  float assets;
  char pet[30];
  char single_char;
  printf("Enter your age, assets, and favorite pet.\n");
  scanf("%d %f", &age, &assets);
  scanf("%s", pet);
  printf("%d $%.2f %s\n", age, assets, pet);
  printf("Enter the best character ever: ");
  items_read = scanf(" %c", &single_char);
  printf("I agree with %c (and read %d items)\n", single_char, items_read);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x30(%rbp),%rsi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    -0x30(%rbp),%rdx
lea    0xeb8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x31(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %eax,-0xc(%rbp)
movsbl -0x31(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xf23(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xea6(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe85(%rip),%rdi
mov    %rbx,%rdx
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
lea    0x7(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%esi
lea    0xe7f(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Enter your age, assets, and favorite pet.\0A\00"
@.str.1 = [6 x i8] c"%d %f\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [13 x i8] c"%d $%.2f %s\0A\00"
@.str.4 = [32 x i8] c"Enter the best character ever: \00"
@.str.5 = [4 x i8] c" %c\00"
@.str.6 = [37 x i8] c"I agree with %c (and read %d items)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca [30 x i8]
%6 = alloca i8
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, float* %4)
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = load i32, i32* %2
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %11, double %13, i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %6)
store i32 %17, i32* %3
%18 = load i8, i8* %6
%19 = sext i8 %18 to i32
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %19, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %f\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [13 x i8] c"%d $%.2f %s\0A\00"
@.str.4 = [32 x i8] c"Enter the best character ever: \00"
@.str.5 = [4 x i8] c" %c\00"
@.str.6 = [37 x i8] c"I agree with %c (and read %d items)\0A\00"
@str = [42 x i8] c"Enter your age, assets, and favorite pet.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca [30 x i8]
%4 = alloca i8
%5 = bitcast i32* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, float* %2)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%11 = load i32, i32* %1
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %11, double %13, i8* %7)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %18, i32 %16)
ret i32 0
}