#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*/ assertStringsEqual(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, double);
void test_0_flag() {
  char buffer[100];
  sprintf(buffer, "%0d", 42);
  assertStringsEqual(buffer, "42");
  sprintf(buffer, "%0ld", 42L);
  assertStringsEqual(buffer, "42");
  sprintf(buffer, "%0d", -42);
  assertStringsEqual(buffer, "-42");
  sprintf(buffer, "%05d", 42);
  assertStringsEqual(buffer, "00042");
  sprintf(buffer, "%05d", -42);
  assertStringsEqual(buffer, "-0042");
  sprintf(buffer, "%015d", 42);
  assertStringsEqual(buffer, "000000000000042");
  sprintf(buffer, "%015d", -42);
  assertStringsEqual(buffer, "-00000000000042");
  sprintf(buffer, "%015.2f", 42.1234);
  assertStringsEqual(buffer, "000000000042.12");
  sprintf(buffer, "%015.3f", 42.9876);
  assertStringsEqual(buffer, "00000000042.988");
  sprintf(buffer, "%015.5f", -42.9876);
  assertStringsEqual(buffer, "-00000042.98760");
}


x86 assembly (clang, -O0):
<test_0_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
lea    0xef5(%rip),%rsi
movsd  0xee5(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xee7(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xed1(%rip),%rsi
movsd  0xebd(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xea5(%rip),%rsi
movsd  0xe8d(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe8a(%rip),%rsi
movsd  0xe6d(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe62(%rip),%rsi
movsd  0xe3d(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe45(%rip),%rsi
movsd  0xe1d(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe1d(%rip),%rsi
movsd  0xded(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe1b(%rip),%rsi
movsd  0xdbd(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe0b(%rip),%rsi
movsd  0xd8d(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdfb(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xdfb(%rip),%rsi
movsd  0xd5d(%rip),%xmm0
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdeb(%rip),%rsi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_0_flag>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0xef8(%rip),%r14
mov    %rsp,%rbx
movsd  0xec5(%rip),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xee5(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
movsd  0xe96(%rip),%xmm0
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
movsd  0xe86(%rip),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe92(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  0xe4f(%rip),%xmm0
call   1040 <sprintf@plt>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  0xe35(%rip),%xmm0
call   1040 <sprintf@plt>
lea    0xe5b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe52(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  0xe04(%rip),%xmm0
call   1040 <sprintf@plt>
lea    0xe3e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  0xdea(%rip),%xmm0
call   1040 <sprintf@plt>
lea    0xe2c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe2d(%rip),%rsi
movsd  0xdcf(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <sprintf@plt>
lea    0xe1e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe1f(%rip),%rsi
movsd  0xdb1(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <sprintf@plt>
lea    0xe10(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe11(%rip),%rsi
movsd  0xd93(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <sprintf@plt>
lea    0xe02(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%0d\00"
@.str.1 = [3 x i8] c"42\00"
@.str.2 = [5 x i8] c"%0ld\00"
@.str.3 = [4 x i8] c"-42\00"
@.str.4 = [5 x i8] c"%05d\00"
@.str.5 = [6 x i8] c"00042\00"
@.str.6 = [6 x i8] c"-0042\00"
@.str.7 = [6 x i8] c"%015d\00"
@.str.8 = [16 x i8] c"000000000000042\00"
@.str.9 = [16 x i8] c"-00000000000042\00"
@.str.10 = [8 x i8] c"%015.2f\00"
@.str.11 = [16 x i8] c"000000000042.12\00"
@.str.12 = [8 x i8] c"%015.3f\00"
@.str.13 = [16 x i8] c"00000000042.988\00"
@.str.14 = [8 x i8] c"%015.5f\00"
@.str.15 = [16 x i8] c"-00000042.98760\00"
define void @test_0_flag() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 4.200000e+01)
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32 @assertStringsEqual(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double 4.200000e+01)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%9 = call i32 @assertStringsEqual(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%11 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double -4.200000e+01)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%13 = call i32 @assertStringsEqual(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%15 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double 4.200000e+01)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%17 = call i32 @assertStringsEqual(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%19 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double -4.200000e+01)
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%21 = call i32 @assertStringsEqual(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%23 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), double 4.200000e+01)
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%25 = call i32 @assertStringsEqual(i8* %24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%27 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), double -4.200000e+01)
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%29 = call i32 @assertStringsEqual(i8* %28, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%31 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), double 4.212340e+01)
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%33 = call i32 @assertStringsEqual(i8* %32, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%35 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double 4.298760e+01)
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%37 = call i32 @assertStringsEqual(i8* %36, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0))
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%39 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), double -4.298760e+01)
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%41 = call i32 @assertStringsEqual(i8* %40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%0d\00"
@.str.1 = [3 x i8] c"42\00"
@.str.2 = [5 x i8] c"%0ld\00"
@.str.3 = [4 x i8] c"-42\00"
@.str.4 = [5 x i8] c"%05d\00"
@.str.5 = [6 x i8] c"00042\00"
@.str.6 = [6 x i8] c"-0042\00"
@.str.7 = [6 x i8] c"%015d\00"
@.str.8 = [16 x i8] c"000000000000042\00"
@.str.9 = [16 x i8] c"-00000000000042\00"
@.str.10 = [8 x i8] c"%015.2f\00"
@.str.11 = [16 x i8] c"000000000042.12\00"
@.str.12 = [8 x i8] c"%015.3f\00"
@.str.13 = [16 x i8] c"00000000042.988\00"
@.str.14 = [8 x i8] c"%015.5f\00"
@.str.15 = [16 x i8] c"-00000042.98760\00"
define void @test_0_flag() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 4.200000e+01)
%4 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double 4.200000e+01)
%6 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double -4.200000e+01)
%8 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double 4.200000e+01)
%10 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double -4.200000e+01)
%12 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), double 4.200000e+01)
%14 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), double -4.200000e+01)
%16 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%17 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), double 4.212340e+01)
%18 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
%19 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), double 4.298760e+01)
%20 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0))
%21 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), double -4.298760e+01)
%22 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
ret void
}