#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 /*<<< orphan*/ scanf(char *, int *, double *);
int /*<<< orphan*/ sprintf(char *, char *, int, double);
int main(void) {
  char s[80];
  int x;
  double y;
  printf("Enter an integer and a double:\n");
  scanf("%d%lf", &x, &y);
  sprintf(s, "integer:%6d\ndouble:%8.2f", x, y);
  printf("%s\n%s\n", "The formatted output stored in array s is:", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x64(%rbp),%rsi
lea    -0x70(%rbp),%rdx
call   1040 <scanf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%edx
movsd  -0x70(%rbp),%xmm0
lea    0xeb2(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x60(%rbp),%rdx
lea    0xebb(%rip),%rdi
lea    0xebb(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%edx
movsd  0x8(%rsp),%xmm0
lea    0xe8e(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
lea    0xe93(%rip),%rdi
lea    0xe93(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Enter an integer and a double:\0A\00"
@.str.1 = [6 x i8] c"%d%lf\00"
@.str.2 = [25 x i8] c"integer:%6d\0Adouble:%8.2f\00"
@.str.3 = [7 x i8] c"%s\0A%s\0A\00"
@.str.4 = [43 x i8] c"The formatted output stored in array s is:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, double* %4)
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* %3
%9 = load double, double* %4
%10 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %8, double %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d%lf\00"
@.str.2 = [25 x i8] c"integer:%6d\0Adouble:%8.2f\00"
@.str.3 = [7 x i8] c"%s\0A%s\0A\00"
@.str.4 = [43 x i8] c"The formatted output stored in array s is:\00"
@str = [31 x i8] c"Enter an integer and a double:\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = alloca double
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, double* %3)
%9 = load i32, i32* %2
%10 = load double, double* %3
%11 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %9, double %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %4)
ret i32 0
}