#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);
void main() {
  int weight = 63;
  printf("\nweight is %d kg", weight);
  printf("\nweight is %2d kg", weight);
  printf("\nweight is %4d kg", weight);
  printf("\nweight is %6d kg", weight);
  printf("\nweight is %-6d kg", weight);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3f,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x3f,%esi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x3f,%esi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x3f,%esi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x3f,%esi
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x3f,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"\0Aweight is %d kg\00"
@.str.1 = [18 x i8] c"\0Aweight is %2d kg\00"
@.str.2 = [18 x i8] c"\0Aweight is %4d kg\00"
@.str.3 = [18 x i8] c"\0Aweight is %6d kg\00"
@.str.4 = [19 x i8] c"\0Aweight is %-6d kg\00"
define void @main() {
%1 = alloca i32
store i32 63, i32* %1
%2 = load i32, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0Aweight is %d kg\00"
@.str.1 = [18 x i8] c"\0Aweight is %2d kg\00"
@.str.2 = [18 x i8] c"\0Aweight is %4d kg\00"
@.str.3 = [18 x i8] c"\0Aweight is %6d kg\00"
@.str.4 = [19 x i8] c"\0Aweight is %-6d kg\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 63)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 63)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 63)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 63)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 63)
ret void
}