#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);
int main() {
  int num = 12;
  printf("num using   %%d is %d \n", num);
  printf("num using  %%1d is %1d \n", num);
  printf("num using  %%2d is %2d \n", num);
  printf("num using  %%3d is %3d \n", num);
  printf("num using  %%4d is %4d \n", num);
  printf("num using %%05d is %05d \n", num);
  printf("num using %%06d is %06d \n", num);
  printf("-num using %%4d is %4d \n", -num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xef7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf01(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf0c(%rip),%rdi
call   1030 <printf@plt>
xor    %esi,%esi
sub    -0x8(%rbp),%esi
lea    0xf15(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xf0f(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xf21(%rip),%rdi
mov    $0xfffffff4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"num using %%d is %d \0A\00"
@.str.1 = [25 x i8] c"num using %%1d is %1d \0A\00"
@.str.2 = [25 x i8] c"num using %%2d is %2d \0A\00"
@.str.3 = [25 x i8] c"num using %%3d is %3d \0A\00"
@.str.4 = [25 x i8] c"num using %%4d is %4d \0A\00"
@.str.5 = [26 x i8] c"num using %%05d is %05d \0A\00"
@.str.6 = [26 x i8] c"num using %%06d is %06d \0A\00"
@.str.7 = [25 x i8] c"-num using %%4d is %4d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 12, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %2
%18 = sub nsw i32 0, %17
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"num using %%d is %d \0A\00"
@.str.1 = [25 x i8] c"num using %%1d is %1d \0A\00"
@.str.2 = [25 x i8] c"num using %%2d is %2d \0A\00"
@.str.3 = [25 x i8] c"num using %%3d is %3d \0A\00"
@.str.4 = [25 x i8] c"num using %%4d is %4d \0A\00"
@.str.5 = [26 x i8] c"num using %%05d is %05d \0A\00"
@.str.6 = [26 x i8] c"num using %%06d is %06d \0A\00"
@.str.7 = [25 x i8] c"-num using %%4d is %4d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 12)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 12)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 12)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 12)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 12)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 12)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 12)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 -12)
ret i32 0
}