#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_plus_flag() {
  char buffer[100];
  sprintf(buffer, "%+d", 42);
  assertStringsEqual(buffer, "+42");
  sprintf(buffer, "%+d", -42);
  assertStringsEqual(buffer, "-42");
  sprintf(buffer, "%+5d", 42);
  assertStringsEqual(buffer, "  +42");
  sprintf(buffer, "%+5d", -42);
  assertStringsEqual(buffer, "  -42");
  sprintf(buffer, "%+15d", 42);
  assertStringsEqual(buffer, "            +42");
  sprintf(buffer, "%+15d", -42);
  assertStringsEqual(buffer, "            -42");
  sprintf(buffer, "%+s", "Hello testing");
  assertStringsEqual(buffer, "Hello testing");
  sprintf(buffer, "%+d", 1024);
  assertStringsEqual(buffer, "+1024");
  sprintf(buffer, "%+d", -1024);
  assertStringsEqual(buffer, "-1024");
  sprintf(buffer, "%+i", 1024);
  assertStringsEqual(buffer, "+1024");
  sprintf(buffer, "%+i", -1024);
  assertStringsEqual(buffer, "-1024");
  sprintf(buffer, "%+u", 1024);
  assertStringsEqual(buffer, "1024");
  sprintf(buffer, "%+u", 4294966272U);
  assertStringsEqual(buffer, "4294966272");
  sprintf(buffer, "%+o", 511);
  assertStringsEqual(buffer, "777");
  sprintf(buffer, "%+o", 4294966785U);
  assertStringsEqual(buffer, "37777777001");
  sprintf(buffer, "%+x", 305441741);
  assertStringsEqual(buffer, "1234abcd");
  sprintf(buffer, "%+x", 3989525555U);
  assertStringsEqual(buffer, "edcb5433");
  sprintf(buffer, "%+X", 305441741);
  assertStringsEqual(buffer, "1234ABCD");
  sprintf(buffer, "%+X", 3989525555U);
  assertStringsEqual(buffer, "EDCB5433");
  sprintf(buffer, "%+c", 'x');
  assertStringsEqual(buffer, "x");
}


x86 assembly (clang, -O0):
<test_plus_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x2a,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0xffffffd6,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x2a,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0xffffffd6,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe3a(%rip),%rsi
mov    $0x2a,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe13(%rip),%rsi
mov    $0xffffffd6,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xe12(%rip),%rsi
lea    0xe0f(%rip),%rdx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xdba(%rip),%rsi
mov    $0x400,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd93(%rip),%rsi
mov    $0xfffffc00,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xdb9(%rip),%rsi
mov    $0x400,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd96(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd92(%rip),%rsi
mov    $0xfffffc00,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd75(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd6f(%rip),%rsi
mov    $0x400,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd49(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd48(%rip),%rsi
mov    $0xfffffc00,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd35(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd30(%rip),%rsi
mov    $0x1ff,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd1d(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xd09(%rip),%rsi
mov    $0xfffffe01,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xcfa(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xcf6(%rip),%rsi
mov    $0x1234abcd,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xce3(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xccf(%rip),%rsi
mov    $0xedcb5433,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xcc5(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xcbe(%rip),%rsi
mov    $0x1234abcd,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xcab(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xc97(%rip),%rsi
mov    $0xedcb5433,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xc8d(%rip),%rsi
call   1030 <assertStringsEqual@plt>
lea    -0x70(%rbp),%rdi
lea    0xc86(%rip),%rsi
mov    $0x78,%edx
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xc45(%rip),%rsi
call   1030 <assertStringsEqual@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_plus_flag>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xece(%rip),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2a,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xffffffd6,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe86(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2a,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe82(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xffffffd6,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe71(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe42(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2a,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe2f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xffffffd6,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe1e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xe1f(%rip),%rsi
lea    0xe1c(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x400,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xdf9(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xfffffc00,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xddb(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xdcf(%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>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0xfffffc00,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <assertStringsEqual@plt>
lea    0xd92(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x400,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd6a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xfffffc00,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd5c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xd58(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1ff,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd43(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xfffffe01,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd26(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xd23(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1234abcd,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xd0e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xedcb5433,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xcf6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xcf0(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1234abcd,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xcdb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xedcb5433,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xcc3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <assertStringsEqual@plt>
lea    0xcbd(%rip),%rsi
mov    %rbx,%rdi
mov    $0x78,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xc7d(%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 = [4 x i8] c"%+d\00"
@.str.1 = [4 x i8] c"+42\00"
@.str.2 = [4 x i8] c"-42\00"
@.str.3 = [5 x i8] c"%+5d\00"
@.str.4 = [6 x i8] c" +42\00"
@.str.5 = [6 x i8] c" -42\00"
@.str.6 = [6 x i8] c"%+15d\00"
@.str.7 = [16 x i8] c" +42\00"
@.str.8 = [16 x i8] c" -42\00"
@.str.9 = [4 x i8] c"%+s\00"
@.str.10 = [14 x i8] c"Hello testing\00"
@.str.11 = [6 x i8] c"+1024\00"
@.str.12 = [6 x i8] c"-1024\00"
@.str.13 = [4 x i8] c"%+i\00"
@.str.14 = [4 x i8] c"%+u\00"
@.str.15 = [5 x i8] c"1024\00"
@.str.16 = [11 x i8] c"4294966272\00"
@.str.17 = [4 x i8] c"%+o\00"
@.str.18 = [4 x i8] c"777\00"
@.str.19 = [12 x i8] c"37777777001\00"
@.str.20 = [4 x i8] c"%+x\00"
@.str.21 = [9 x i8] c"1234abcd\00"
@.str.22 = [9 x i8] c"edcb5433\00"
@.str.23 = [4 x i8] c"%+X\00"
@.str.24 = [9 x i8] c"1234ABCD\00"
@.str.25 = [9 x i8] c"EDCB5433\00"
@.str.26 = [4 x i8] c"%+c\00"
@.str.27 = [2 x i8] c"x\00"
define void @test_plus_flag() {
%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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42)
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32 @assertStringsEqual(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 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 (i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -42)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%9 = call i32 @assertStringsEqual(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 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 (i8*, i8*, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 42)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%13 = call i32 @assertStringsEqual(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, 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 ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 -42)
%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 (i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 42)
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%21 = call i32 @assertStringsEqual(i8* %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, 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 ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 -42)
%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 (i8*, i8*, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%29 = call i32 @assertStringsEqual(i8* %28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, 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 ([4 x i8], [4 x i8]* @.str, 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 ([6 x i8], [6 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 (i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, 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 ([6 x i8], [6 x i8]* @.str.12, 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 ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 1024)
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%41 = call i32 @assertStringsEqual(i8* %40, i8* getelementptr inbounds ([6 x i8], [6 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 (i8*, i8*, ...) @sprintf(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 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 ([6 x i8], [6 x i8]* @.str.12, 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 ([4 x i8], [4 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 ([5 x i8], [5 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 ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 -1024)
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%53 = call i32 @assertStringsEqual(i8* %52, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, 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 ([4 x i8], [4 x i8]* @.str.17, 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 ([4 x i8], [4 x i8]* @.str.18, 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 ([4 x i8], [4 x i8]* @.str.17, 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 ([12 x i8], [12 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 ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32 305441741)
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%65 = call i32 @assertStringsEqual(i8* %64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.21, 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 ([4 x i8], [4 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 ([9 x i8], [9 x i8]* @.str.22, 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 ([4 x i8], [4 x i8]* @.str.23, 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 ([9 x i8], [9 x i8]* @.str.24, 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 ([4 x i8], [4 x i8]* @.str.23, i64 0, i64 0), i32 -305441741)
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%77 = call i32 @assertStringsEqual(i8* %76, i8* getelementptr inbounds ([9 x i8], [9 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 ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0), i32 120)
%80 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%81 = call i32 @assertStringsEqual(i8* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.27, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%+d\00"
@.str.1 = [4 x i8] c"+42\00"
@.str.2 = [4 x i8] c"-42\00"
@.str.3 = [5 x i8] c"%+5d\00"
@.str.4 = [6 x i8] c" +42\00"
@.str.5 = [6 x i8] c" -42\00"
@.str.6 = [6 x i8] c"%+15d\00"
@.str.7 = [16 x i8] c" +42\00"
@.str.8 = [16 x i8] c" -42\00"
@.str.9 = [4 x i8] c"%+s\00"
@.str.10 = [14 x i8] c"Hello testing\00"
@.str.11 = [6 x i8] c"+1024\00"
@.str.12 = [6 x i8] c"-1024\00"
@.str.13 = [4 x i8] c"%+i\00"
@.str.14 = [4 x i8] c"%+u\00"
@.str.15 = [5 x i8] c"1024\00"
@.str.16 = [11 x i8] c"4294966272\00"
@.str.17 = [4 x i8] c"%+o\00"
@.str.18 = [4 x i8] c"777\00"
@.str.19 = [12 x i8] c"37777777001\00"
@.str.20 = [4 x i8] c"%+x\00"
@.str.21 = [9 x i8] c"1234abcd\00"
@.str.22 = [9 x i8] c"edcb5433\00"
@.str.23 = [4 x i8] c"%+X\00"
@.str.24 = [9 x i8] c"1234ABCD\00"
@.str.25 = [9 x i8] c"EDCB5433\00"
@.str.26 = [4 x i8] c"%+c\00"
@.str.27 = [2 x i8] c"x\00"
define void @test_plus_flag() {
%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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42)
%4 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -42)
%6 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 42)
%8 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 -42)
%10 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 42)
%12 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 -42)
%14 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%16 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%17 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1024)
%18 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -1024)
%20 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 1024)
%22 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%23 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 -1024)
%24 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 1024)
%26 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 -1024)
%28 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
%29 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i32 511)
%30 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
%31 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i32 -511)
%32 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0))
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32 305441741)
%34 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.21, i64 0, i64 0))
%35 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32 -305441741)
%36 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i64 0, i64 0))
%37 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i64 0, i64 0), i32 305441741)
%38 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0))
%39 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i64 0, i64 0), i32 -305441741)
%40 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.25, i64 0, i64 0))
%41 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0), i32 120)
%42 = call i32 @assertStringsEqual(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.27, i64 0, i64 0))
ret void
}