#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 *, unsigned int);
void test_padding_20() {
  char buffer[100];
  sprintf(buffer, "%020d", 1024);
  assertStringsEqual(buffer, "00000000000000001024");
  sprintf(buffer, "%020d", -1024);
  assertStringsEqual(buffer, "-0000000000000001024");
  sprintf(buffer, "%020i", 1024);
  assertStringsEqual(buffer, "00000000000000001024");
  sprintf(buffer, "%020i", -1024);
  assertStringsEqual(buffer, "-0000000000000001024");
  sprintf(buffer, "%020u", 1024);
  assertStringsEqual(buffer, "00000000000000001024");
  sprintf(buffer, "%020u", 4294966272U);
  assertStringsEqual(buffer, "00000000004294966272");
  sprintf(buffer, "%020o", 511);
  assertStringsEqual(buffer, "00000000000000000777");
  sprintf(buffer, "%020o", 4294966785U);
  assertStringsEqual(buffer, "00000000037777777001");
  sprintf(buffer, "%020x", 305441741);
  assertStringsEqual(buffer, "0000000000001234abcd");
  sprintf(buffer, "%020x", 3989525555U);
  assertStringsEqual(buffer, "000000000000edcb5433");
  sprintf(buffer, "%020X", 305441741);
  assertStringsEqual(buffer, "0000000000001234ABCD");
  sprintf(buffer, "%020X", 3989525555U);
  assertStringsEqual(buffer, "000000000000EDCB5433");
}


x86 assembly (clang, -O0):
<test_padding_20>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x400,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xea8(%rip),%rsi
mov    $0xfffffc00,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x400,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0xfffffc00,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x400,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe4a(%rip),%rsi
mov    $0xfffffc00,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe40(%rip),%rsi
mov    $0x1ff,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe1b(%rip),%rsi
mov    $0xfffffe01,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe26(%rip),%rsi
mov    $0x1234abcd,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe01(%rip),%rsi
mov    $0xedcb5433,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe0c(%rip),%rsi
mov    $0x1234abcd,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xde7(%rip),%rsi
mov    $0xedcb5433,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xded(%rip),%rsi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_padding_20>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xece(%rip),%r15
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x400,%edx
call   1040 <sprintf@plt>
lea    0xeba(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xfffffc00,%edx
call   1040 <sprintf@plt>
lea    0xead(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xeb0(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0xfffffc00,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xe79(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x400,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xfffffc00,%edx
call   1040 <sprintf@plt>
lea    0xe4d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe53(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1ff,%edx
call   1040 <sprintf@plt>
lea    0xe42(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xfffffe01,%edx
call   1040 <sprintf@plt>
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe3e(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1234abcd,%edx
call   1040 <sprintf@plt>
lea    0xe2d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xedcb5433,%edx
call   1040 <sprintf@plt>
lea    0xe23(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe29(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1234abcd,%edx
call   1040 <sprintf@plt>
lea    0xe18(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xedcb5433,%edx
call   1040 <sprintf@plt>
lea    0xe0e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%020d\00"
@.str.1 = [21 x i8] c"00000000000000001024\00"
@.str.2 = [21 x i8] c"-0000000000000001024\00"
@.str.3 = [6 x i8] c"%020i\00"
@.str.4 = [6 x i8] c"%020u\00"
@.str.5 = [21 x i8] c"00000000004294966272\00"
@.str.6 = [6 x i8] c"%020o\00"
@.str.7 = [21 x i8] c"00000000000000000777\00"
@.str.8 = [21 x i8] c"00000000037777777001\00"
@.str.9 = [6 x i8] c"%020x\00"
@.str.10 = [21 x i8] c"0000000000001234abcd\00"
@.str.11 = [21 x i8] c"000000000000edcb5433\00"
@.str.12 = [6 x i8] c"%020X\00"
@.str.13 = [21 x i8] c"0000000000001234ABCD\00"
@.str.14 = [21 x i8] c"000000000000EDCB5433\00"
define void @test_padding_20() {
%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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1024)
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32 @assertStringsEqual(i8* %4, i8* getelementptr inbounds ([21 x i8], [21 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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1024)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%9 = call i32 @assertStringsEqual(i8* %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, 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 ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 1024)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%13 = call i32 @assertStringsEqual(i8* %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, 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 ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 -1024)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%17 = call i32 @assertStringsEqual(i8* %16, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, 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 ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 1024)
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%21 = call i32 @assertStringsEqual(i8* %20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, 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.4, i64 0, i64 0), i32 -1024)
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%25 = call i32 @assertStringsEqual(i8* %24, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, 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.6, i64 0, i64 0), i32 511)
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%29 = call i32 @assertStringsEqual(i8* %28, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, 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 ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 -511)
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%33 = call i32 @assertStringsEqual(i8* %32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, 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 ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 305441741)
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%37 = call i32 @assertStringsEqual(i8* %36, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, 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 ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 -305441741)
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%41 = call i32 @assertStringsEqual(i8* %40, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%43 = call i32 @sprintf(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 305441741)
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%45 = call i32 @assertStringsEqual(i8* %44, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%47 = call i32 @sprintf(i8* %46, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 -305441741)
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%49 = call i32 @assertStringsEqual(i8* %48, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%020d\00"
@.str.1 = [21 x i8] c"00000000000000001024\00"
@.str.2 = [21 x i8] c"-0000000000000001024\00"
@.str.3 = [6 x i8] c"%020i\00"
@.str.4 = [6 x i8] c"%020u\00"
@.str.5 = [21 x i8] c"00000000004294966272\00"
@.str.6 = [6 x i8] c"%020o\00"
@.str.7 = [21 x i8] c"00000000000000000777\00"
@.str.8 = [21 x i8] c"00000000037777777001\00"
@.str.9 = [6 x i8] c"%020x\00"
@.str.10 = [21 x i8] c"0000000000001234abcd\00"
@.str.11 = [21 x i8] c"000000000000edcb5433\00"
@.str.12 = [6 x i8] c"%020X\00"
@.str.13 = [21 x i8] c"0000000000001234ABCD\00"
@.str.14 = [21 x i8] c"000000000000EDCB5433\00"
define void @test_padding_20() {
%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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1024)
%4 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -1024)
%6 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 1024)
%8 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 -1024)
%10 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 1024)
%12 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 -1024)
%14 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 511)
%16 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 -511)
%18 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 305441741)
%20 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
%21 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 -305441741)
%22 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
%23 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 305441741)
%24 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
%25 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 -305441741)
%26 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0))
ret void
}