#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() {
  printf("hello %5s\n", "world");
  printf("hello %10s\n", "world");
  printf("hello %-10s\n", "world");
  int n = 0x1234, t = 3;
  printf("%#01x %#02x %#03x %#04x\n", n, n, n, n);
  printf("%#07x 0x%07x %#7x 0x%7x\n", n, n, n, n);
  float f = 3.14159;
  printf("%8.2f %.3f\n", f, f);
  printf("%d %6d %6.3d\n", t, t, t);
  printf("'%d' '%6d' '%6.3d' '%6.9d'\n", n, n, n, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xede(%rip),%rdi
lea    0xee2(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1234,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  0xe56(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe98(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef0(%rip),%rdi
lea    0xef4(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    $0x1234,%esi
mov    $0x1234,%edx
mov    $0x1234,%ecx
mov    $0x1234,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
mov    $0x1234,%esi
mov    $0x1234,%edx
mov    $0x1234,%ecx
mov    $0x1234,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
movsd  0xe60(%rip),%xmm0
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x1234,%esi
mov    $0x1234,%edx
mov    $0x1234,%ecx
mov    $0x1234,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"hello %5s\0A\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [12 x i8] c"hello %10s\0A\00"
@.str.3 = [13 x i8] c"hello %-10s\0A\00"
@.str.4 = [25 x i8] c"%x %x %x %x\0A\00"
@.str.5 = [25 x i8] c"%x 0x%07x %x 0x%7x\0A\00"
@.str.6 = [12 x i8] c"%8.2f %.3f\0A\00"
@.str.7 = [14 x i8] c"%d %6d %6.3d\0A\00"
@.str.8 = [28 x i8] c"'%d' '%6d' '%6.3d' '%6.9d'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 4660, i32* %2
store i32 3, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %8, i32 %9, i32 %10, i32 %11)
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %13, i32 %14, i32 %15, i32 %16)
store float 0x400921FA00000000, float* %4
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = load float, float* %4
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), double %19, double %21)
%23 = load i32, i32* %3
%24 = load i32, i32* %3
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %2
%28 = load i32, i32* %2
%29 = load i32, i32* %2
%30 = load i32, i32* %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %27, i32 %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"hello %5s\0A\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [12 x i8] c"hello %10s\0A\00"
@.str.3 = [13 x i8] c"hello %-10s\0A\00"
@.str.4 = [25 x i8] c"%x %x %x %x\0A\00"
@.str.5 = [25 x i8] c"%x 0x%07x %x 0x%7x\0A\00"
@.str.6 = [12 x i8] c"%8.2f %.3f\0A\00"
@.str.7 = [14 x i8] c"%d %6d %6.3d\0A\00"
@.str.8 = [28 x i8] c"'%d' '%6d' '%6.3d' '%6.9d'\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 4660, i32 4660, i32 4660, i32 4660)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 4660, i32 4660, i32 4660, i32 4660)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), double 0x400921FA00000000, double 0x400921FA00000000)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 3, i32 3, i32 3)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 4660, i32 4660, i32 4660, i32 4660)
ret i32 0
}