#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 main() {
  int intnum;
  float floatnum;
  double doublenum;
  printf("This program demonstrates displaying\n"
         "output with variable references\n\n");
  intnum = 209;
  printf("Result: %d\n", intnum);
  floatnum = 20.12F;
  printf("Result: %3.2f\n", floatnum);
  doublenum = 123.456;
  printf("Result: %4.3lf\n", doublenum);
  printf("Two values at once: %d %6.1f\n", intnum, floatnum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xd1,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  0xebb(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xefd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe8f(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xeec(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xee2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf31(%rip),%rdi
call   1030 <puts@plt>
lea    0xedc(%rip),%rdi
mov    $0xd1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
movsd  0xeb1(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
movsd  0xea3(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0xd1,%esi
movsd  0xe80(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [71 x i8] c"This program demonstrates displaying\0Aoutput with variable references\0A\0A\00"
@.str.1 = [12 x i8] c"Result: %d\0A\00"
@.str.2 = [15 x i8] c"Result: %3.2f\0A\00"
@.str.3 = [16 x i8] c"Result: %4.3lf\0A\00"
@.str.4 = [30 x i8] c"Two values at once: %d %6.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
store i32 209, i32* %2
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %6)
store float 0x40341EB860000000, float* %3
%8 = load float, float* %3
%9 = fpext float %8 to double
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %9)
store double 1.234560e+02, double* %4
%11 = load double, double* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %11)
%13 = load i32, i32* %2
%14 = load float, float* %3
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %13, double %15)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"Result: %d\0A\00"
@.str.2 = [15 x i8] c"Result: %3.2f\0A\00"
@.str.3 = [16 x i8] c"Result: %4.3lf\0A\00"
@.str.4 = [30 x i8] c"Two values at once: %d %6.1f\0A\00"
@str = [70 x i8] c"This program demonstrates displaying\0Aoutput with variable references\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 209)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double 0x40341EB860000000)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double 1.234560e+02)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 209, double 0x40341EB860000000)
ret i32 0
}