#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_alt_020() {
  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, "0x00000000001234abcd");
  sprintf(buffer, "%#020x", 3989525555U);
  assertStringsEqual(buffer, "0x0000000000edcb5433");
  sprintf(buffer, "%#020X", 305441741);
  assertStringsEqual(buffer, "0X00000000001234ABCD");
  sprintf(buffer, "%#020X", 3989525555U);
  assertStringsEqual(buffer, "0X0000000000EDCB5433");
}


x86 assembly (clang, -O0):
<test_padding_alt_020>:
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    0xebf(%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    0xeaf(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x400,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0xfffffc00,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe71(%rip),%rsi
mov    $0x400,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe4c(%rip),%rsi
mov    $0xfffffc00,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe43(%rip),%rsi
mov    $0x1ff,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe1e(%rip),%rsi
mov    $0xfffffe01,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe2a(%rip),%rsi
mov    $0x1234abcd,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe05(%rip),%rsi
mov    $0xedcb5433,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe0c(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe11(%rip),%rsi
mov    $0x1234abcd,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe03(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xdec(%rip),%rsi
mov    $0xedcb5433,%edx
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdf3(%rip),%rsi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_padding_alt_020>:
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    0xebb(%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    0xeae(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xeb1(%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    0xe7b(%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    0xe50(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe56(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1ff,%edx
call   1040 <sprintf@plt>
lea    0xe46(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xfffffe01,%edx
call   1040 <sprintf@plt>
lea    0xe3c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe42(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1234abcd,%edx
call   1040 <sprintf@plt>
lea    0xe32(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xedcb5433,%edx
call   1040 <sprintf@plt>
lea    0xe28(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe2e(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1234abcd,%edx
call   1040 <sprintf@plt>
lea    0xe1e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xedcb5433,%edx
call   1040 <sprintf@plt>
lea    0xe14(%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 = [7 x i8] c"%d\00"
@.str.1 = [21 x i8] c"00000000000000001024\00"
@.str.2 = [21 x i8] c"-0000000000000001024\00"
@.str.3 = [7 x i8] c"%i\00"
@.str.4 = [7 x i8] c"%u\00"
@.str.5 = [21 x i8] c"00000000004294966272\00"
@.str.6 = [7 x i8] c"%o\00"
@.str.7 = [21 x i8] c"00000000000000000777\00"
@.str.8 = [21 x i8] c"00000000037777777001\00"
@.str.9 = [7 x i8] c"%x\00"
@.str.10 = [21 x i8] c"0x00000000001234abcd\00"
@.str.11 = [21 x i8] c"0x0000000000edcb5433\00"
@.str.12 = [7 x i8] c"%X\00"
@.str.13 = [21 x i8] c"0X00000000001234ABCD\00"
@.str.14 = [21 x i8] c"0X0000000000EDCB5433\00"
define void @test_padding_alt_020() {
%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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 = [7 x i8] c"%d\00"
@.str.1 = [21 x i8] c"00000000000000001024\00"
@.str.2 = [21 x i8] c"-0000000000000001024\00"
@.str.3 = [7 x i8] c"%i\00"
@.str.4 = [7 x i8] c"%u\00"
@.str.5 = [21 x i8] c"00000000004294966272\00"
@.str.6 = [7 x i8] c"%o\00"
@.str.7 = [21 x i8] c"00000000000000000777\00"
@.str.8 = [21 x i8] c"00000000037777777001\00"
@.str.9 = [7 x i8] c"%x\00"
@.str.10 = [21 x i8] c"0x00000000001234abcd\00"
@.str.11 = [21 x i8] c"0x0000000000edcb5433\00"
@.str.12 = [7 x i8] c"%X\00"
@.str.13 = [21 x i8] c"0X00000000001234ABCD\00"
@.str.14 = [21 x i8] c"0X0000000000EDCB5433\00"
define void @test_padding_alt_020() {
%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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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 ([7 x i8], [7 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
}