#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 *, ...);
void test_length() {
  char buffer[100];
  sprintf(buffer, "%.0s", "Hello testing");
  assertStringsEqual(buffer, "");
  sprintf(buffer, "%20.0s", "Hello testing");
  assertStringsEqual(buffer, "                    ");
  sprintf(buffer, "%.s", "Hello testing");
  assertStringsEqual(buffer, "");
  sprintf(buffer, "%20.s", "Hello testing");
  assertStringsEqual(buffer, "                    ");
  sprintf(buffer, "%20.0d", 1024);
  assertStringsEqual(buffer, "                1024");
  sprintf(buffer, "%20.0d", -1024);
  assertStringsEqual(buffer, "               -1024");
  sprintf(buffer, "%20.d", 0);
  assertStringsEqual(buffer, "                    ");
  sprintf(buffer, "%20.0i", 1024);
  assertStringsEqual(buffer, "                1024");
  sprintf(buffer, "%20.i", -1024);
  assertStringsEqual(buffer, "               -1024");
  sprintf(buffer, "%20.i", 0);
  assertStringsEqual(buffer, "                    ");
  sprintf(buffer, "%20.u", 1024);
  assertStringsEqual(buffer, "                1024");
  sprintf(buffer, "%20.0u", 4294966272U);
  assertStringsEqual(buffer, "          4294966272");
  sprintf(buffer, "%20.u", 0U);
  assertStringsEqual(buffer, "                    ");
  sprintf(buffer, "%20.o", 511);
  assertStringsEqual(buffer, "                 777");
  sprintf(buffer, "%20.0o", 4294966785U);
  assertStringsEqual(buffer, "         37777777001");
  sprintf(buffer, "%20.o", 0U);
  assertStringsEqual(buffer, "                    ");
  sprintf(buffer, "%20.x", 305441741);
  assertStringsEqual(buffer, "            1234abcd");
  sprintf(buffer, "%50.x", 305441741);
  assertStringsEqual(buffer,
                     "                                          1234abcd");
  sprintf(buffer, "%50.x%10.u", 305441741, 12345);
  assertStringsEqual(
      buffer, "                                          1234abcd     12345");
  sprintf(buffer, "%20.0x", 3989525555U);
  assertStringsEqual(buffer, "            edcb5433");
  sprintf(buffer, "%20.x", 0U);
  assertStringsEqual(buffer, "                    ");
  sprintf(buffer, "%20.X", 305441741);
  assertStringsEqual(buffer, "            1234ABCD");
  sprintf(buffer, "%20.0X", 3989525555U);
  assertStringsEqual(buffer, "            EDCB5433");
  sprintf(buffer, "%20.X", 0U);
  assertStringsEqual(buffer, "                    ");
}


x86 assembly (clang, -O0):
<test_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
lea    0xecd(%rip),%rsi
lea    0xecb(%rip),%rdx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xee2(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xeb7(%rip),%rsi
lea    0xea2(%rip),%rdx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xeaa(%rip),%rsi
lea    0xe79(%rip),%rdx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe85(%rip),%rsi
lea    0xe50(%rip),%rdx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe62(%rip),%rsi
mov    $0x400,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe3b(%rip),%rsi
mov    $0xfffffc00,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe45(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xde1(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe27(%rip),%rsi
mov    $0x400,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xde0(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe07(%rip),%rsi
mov    $0xfffffc00,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdce(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xde0(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd6f(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xdc2(%rip),%rsi
mov    $0x400,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd6e(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xda1(%rip),%rsi
mov    $0xfffffc00,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd91(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd74(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xcfd(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd72(%rip),%rsi
mov    $0x1ff,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd61(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd66(%rip),%rsi
mov    $0xfffffe01,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd56(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd24(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xc8b(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd37(%rip),%rsi
mov    $0x1234abcd,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd4a(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd16(%rip),%rsi
mov    $0x1234abcd,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd05(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd28(%rip),%rsi
mov    $0x1234abcd,%edx
mov    $0x3039,%ecx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd17(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd44(%rip),%rsi
mov    $0xedcb5433,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd34(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xc96(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xbc6(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd15(%rip),%rsi
mov    $0x1234abcd,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd04(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd09(%rip),%rsi
mov    $0xedcb5433,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xcf9(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xcc7(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xb54(%rip),%rsi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_length>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x70,%rsp
lea    0xecc(%rip),%rsi
lea    0xeca(%rip),%r15
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xedc(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xea2(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xe71(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe5f(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0xfffffc00,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe50(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xe53(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xe3b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x400,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xe21(%rip),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0xfffffc00,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xde9(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xdcb(%rip),%rsi
mov    %rbx,%rdi
mov    $0xfffffc00,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xdbc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xda8(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1ff,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd95(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xd9b(%rip),%rsi
mov    %rbx,%rdi
mov    $0xfffffe01,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd8c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xd78(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1234abcd,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd89(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xd56(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1234abcd,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd46(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xd6a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1234abcd,%edx
mov    $0x3039,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd5a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xd88(%rip),%rsi
mov    %rbx,%rdi
mov    $0xedcb5433,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd79(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xd65(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1234abcd,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd52(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xd58(%rip),%rsi
mov    %rbx,%rdi
mov    $0xedcb5433,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd49(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.0s\00"
@.str.1 = [14 x i8] c"Hello testing\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [7 x i8] c"%20.0s\00"
@.str.4 = [21 x i8] c" \00"
@.str.5 = [4 x i8] c"%.s\00"
@.str.6 = [6 x i8] c"%20.s\00"
@.str.7 = [7 x i8] c"%20.0d\00"
@.str.8 = [21 x i8] c" 1024\00"
@.str.9 = [21 x i8] c" -1024\00"
@.str.10 = [6 x i8] c"%20.d\00"
@.str.11 = [7 x i8] c"%20.0i\00"
@.str.12 = [6 x i8] c"%20.i\00"
@.str.13 = [6 x i8] c"%20.u\00"
@.str.14 = [7 x i8] c"%20.0u\00"
@.str.15 = [21 x i8] c" 4294966272\00"
@.str.16 = [6 x i8] c"%20.o\00"
@.str.17 = [21 x i8] c" 777\00"
@.str.18 = [7 x i8] c"%20.0o\00"
@.str.19 = [21 x i8] c" 37777777001\00"
@.str.20 = [6 x i8] c"%20.x\00"
@.str.21 = [21 x i8] c" 1234abcd\00"
@.str.22 = [6 x i8] c"%50.x\00"
@.str.23 = [51 x i8] c" 1234abcd\00"
@.str.24 = [11 x i8] c"%50.x%10.u\00"
@.str.25 = [61 x i8] c" 1234abcd 12345\00"
@.str.26 = [7 x i8] c"%20.0x\00"
@.str.27 = [21 x i8] c" edcb5433\00"
@.str.28 = [6 x i8] c"%20.X\00"
@.str.29 = [21 x i8] c" 1234ABCD\00"
@.str.30 = [7 x i8] c"%20.0X\00"
@.str.31 = [21 x i8] c" EDCB5433\00"
define void @test_length() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32 @assertStringsEqual(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%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.4, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%13 = call i32 @assertStringsEqual(i8* %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%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.4, i64 0, i64 0))
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, 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.8, i64 0, i64 0))
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%23 = call i32 (i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, 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.9, i64 0, i64 0))
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 0)
%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.4, i64 0, i64 0))
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%31 = call i32 (i8*, i8*, ...) @sprintf(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 1024)
%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 (i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 -1024)
%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.9, i64 0, i64 0))
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%39 = call i32 (i8*, i8*, ...) @sprintf(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 0)
%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.4, i64 0, i64 0))
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%43 = call i32 (i8*, i8*, ...) @sprintf(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 1024)
%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.8, i64 0, i64 0))
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%47 = call i32 (i8*, i8*, ...) @sprintf(i8* %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 -1024)
%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.15, i64 0, i64 0))
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%51 = call i32 (i8*, i8*, ...) @sprintf(i8* %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 0)
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%53 = call i32 @assertStringsEqual(i8* %52, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%55 = call i32 (i8*, i8*, ...) @sprintf(i8* %54, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32 511)
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%57 = call i32 @assertStringsEqual(i8* %56, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0))
%58 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%59 = call i32 (i8*, i8*, ...) @sprintf(i8* %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i32 -511)
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%61 = call i32 @assertStringsEqual(i8* %60, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0))
%62 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%63 = call i32 (i8*, i8*, ...) @sprintf(i8* %62, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32 0)
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%65 = call i32 @assertStringsEqual(i8* %64, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%66 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%67 = call i32 (i8*, i8*, ...) @sprintf(i8* %66, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i32 305441741)
%68 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%69 = call i32 @assertStringsEqual(i8* %68, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.21, i64 0, i64 0))
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%71 = call i32 (i8*, i8*, ...) @sprintf(i8* %70, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i32 305441741)
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%73 = call i32 @assertStringsEqual(i8* %72, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.23, i64 0, i64 0))
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%75 = call i32 (i8*, i8*, ...) @sprintf(i8* %74, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0), i32 305441741, i32 12345)
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%77 = call i32 @assertStringsEqual(i8* %76, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.25, i64 0, i64 0))
%78 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%79 = call i32 (i8*, i8*, ...) @sprintf(i8* %78, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.26, i64 0, i64 0), i32 -305441741)
%80 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%81 = call i32 @assertStringsEqual(i8* %80, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.27, i64 0, i64 0))
%82 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%83 = call i32 (i8*, i8*, ...) @sprintf(i8* %82, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i32 0)
%84 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%85 = call i32 @assertStringsEqual(i8* %84, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%86 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%87 = call i32 (i8*, i8*, ...) @sprintf(i8* %86, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i64 0, i64 0), i32 305441741)
%88 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%89 = call i32 @assertStringsEqual(i8* %88, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.29, i64 0, i64 0))
%90 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%91 = call i32 (i8*, i8*, ...) @sprintf(i8* %90, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.30, i64 0, i64 0), i32 -305441741)
%92 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%93 = call i32 @assertStringsEqual(i8* %92, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.31, i64 0, i64 0))
%94 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%95 = call i32 (i8*, i8*, ...) @sprintf(i8* %94, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i64 0, i64 0), i32 0)
%96 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%97 = call i32 @assertStringsEqual(i8* %96, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.0s\00"
@.str.1 = [14 x i8] c"Hello testing\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [7 x i8] c"%20.0s\00"
@.str.4 = [21 x i8] c" \00"
@.str.5 = [4 x i8] c"%.s\00"
@.str.6 = [6 x i8] c"%20.s\00"
@.str.7 = [7 x i8] c"%20.0d\00"
@.str.8 = [21 x i8] c" 1024\00"
@.str.9 = [21 x i8] c" -1024\00"
@.str.10 = [6 x i8] c"%20.d\00"
@.str.11 = [7 x i8] c"%20.0i\00"
@.str.12 = [6 x i8] c"%20.i\00"
@.str.13 = [6 x i8] c"%20.u\00"
@.str.14 = [7 x i8] c"%20.0u\00"
@.str.15 = [21 x i8] c" 4294966272\00"
@.str.16 = [6 x i8] c"%20.o\00"
@.str.17 = [21 x i8] c" 777\00"
@.str.18 = [7 x i8] c"%20.0o\00"
@.str.19 = [21 x i8] c" 37777777001\00"
@.str.20 = [6 x i8] c"%20.x\00"
@.str.21 = [21 x i8] c" 1234abcd\00"
@.str.22 = [6 x i8] c"%50.x\00"
@.str.23 = [51 x i8] c" 1234abcd\00"
@.str.24 = [11 x i8] c"%50.x%10.u\00"
@.str.25 = [61 x i8] c" 1234abcd 12345\00"
@.str.26 = [7 x i8] c"%20.0x\00"
@.str.27 = [21 x i8] c" edcb5433\00"
@.str.28 = [6 x i8] c"%20.X\00"
@.str.29 = [21 x i8] c" 1234ABCD\00"
@.str.30 = [7 x i8] c"%20.0X\00"
@.str.31 = [21 x i8] c" EDCB5433\00"
define void @test_length() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 1024)
%12 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 -1024)
%14 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 0)
%16 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 1024)
%18 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 -1024)
%20 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 0)
%22 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 1024)
%24 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 -1024)
%26 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 0)
%28 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32 511)
%30 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0))
%31 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i32 -511)
%32 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0))
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32 0)
%34 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%35 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i32 305441741)
%36 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.21, i64 0, i64 0))
%37 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i32 305441741)
%38 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.23, i64 0, i64 0))
%39 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0), i32 305441741, i32 12345)
%40 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.25, i64 0, i64 0))
%41 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.26, i64 0, i64 0), i32 -305441741)
%42 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.27, i64 0, i64 0))
%43 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i32 0)
%44 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%45 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i64 0, i64 0), i32 305441741)
%46 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.29, i64 0, i64 0))
%47 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.30, i64 0, i64 0), i32 -305441741)
%48 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.31, i64 0, i64 0))
%49 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i64 0, i64 0), i32 0)
%50 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
ret void
}