#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*/ puts(char const *);
int /*<<< orphan*/ sprintf(char *, char *, char volatile, int volatile,
                           float volatile, char volatile *);
int main() {
  volatile char c = '0';
  volatile int x = 12;
  volatile float f = 1.239;
  volatile char s[] = "34";
  volatile char buf[2];
  sprintf((char *)buf, "%c %d %.3f %s\n", c, x, f, s);
  puts((const char *)buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x30,-0x5(%rbp)
movl   $0xc,-0xc(%rbp)
movss  0xebe(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x13(%rbp),%rax
mov    0xeb5(%rip),%cl
mov    %cl,0x2(%rax)
mov    0xea9(%rip),%cx
mov    %cx,(%rax)
lea    -0x15(%rbp),%rdi
mov    -0x5(%rbp),%al
mov    -0xc(%rbp),%ecx
movss  -0x10(%rbp),%xmm0
lea    -0x13(%rbp),%r8
lea    0xe8f(%rip),%rsi
movsbl %al,%edx
call   1040 <sprintf@plt>
lea    -0x15(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movb   $0x30,0xf(%rsp)
movl   $0xc,0x18(%rsp)
movl   $0x3f9e978d,0x14(%rsp)
3f
mov    0xec2(%rip),%al
mov    %al,0x12(%rsp)
movzwl 0xeb5(%rip),%eax
mov    %ax,0x10(%rsp)
movsbl 0xf(%rsp),%edx
mov    0x18(%rsp),%ecx
movss  0x14(%rsp),%xmm0
lea    0xe9d(%rip),%rsi
lea    0x1e(%rsp),%rbx
lea    0x10(%rsp),%r8
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [3 x i8] c"34\00"
@.str = [15 x i8] c"%c %d %.3f %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca float
%5 = alloca [3 x i8]
%6 = alloca [2 x i8]
store i32 0, i32* %1
store volatile i8 48, i8* %2
store volatile i32 12, i32* %3
store volatile float 0x3FF3D2F1A0000000, float* %4
%7 = bitcast [3 x i8]* %5 to i8*
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%9 = load volatile i8, i8* %2
%10 = load volatile i32, i32* %3
%11 = load volatile float, float* %4
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%13 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8 signext %9, i32 %10, float %11, i8* %12)
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%15 = call i32 @puts(i8* %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [3 x i8] c"34\00"
@.str = [15 x i8] c"%c %d %.3f %s\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca float
%4 = alloca [3 x i8]
%5 = alloca [2 x i8]
store volatile i8 48, i8* %1
%6 = bitcast i32* %2 to i8*
store volatile i32 12, i32* %2
%7 = bitcast float* %3 to i8*
store volatile float 0x3FF3D2F1A0000000, float* %3
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%10 = load volatile i8, i8* %1
%11 = load volatile i32, i32* %2
%12 = load volatile float, float* %3
%13 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8 signext %10, i32 %11, float %12, i8* %8)
%14 = call i32 @puts(i8* %9)
ret i32 0
}