void pr9751() {
  const char kFormat1[] = "%s";
  printf(kFormat1, 5);
  printf("%s", 5);
  const char kFormat2[] = "%.3p";
  void *p;
  printf(kFormat2, p);
  printf("%.3p", p);
  const char kFormat3[] = "%0s";
  printf(kFormat3, "a");
  printf("%0s", "a");
  const char kFormat4[] = "%hhs";
  printf(kFormat4, "a");
  printf("%hhs", "a");
  const char kFormat5[] = "%-0d";
  printf(kFormat5, 5);
  printf("%-0d", 5);
  const char kFormat6[] = "%00d";
  int *i;
  scanf(kFormat6, i);
  scanf("%00d", i);
}


x86 assembly (clang, -O0):
<pr9751>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xec9(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x3(%rbp),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe9e(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xe99(%rip),%al
mov    %al,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe70(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe54(%rip),%rdi
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe46(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xe41(%rip),%al
mov    %al,-0x15(%rbp)
lea    -0x19(%rbp),%rdi
lea    0xe2d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe21(%rip),%rdi
lea    0xe18(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe12(%rip),%eax
mov    %eax,-0x1e(%rbp)
mov    0xe0d(%rip),%al
mov    %al,-0x1a(%rbp)
lea    -0x1e(%rbp),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdef(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xde2(%rip),%eax
mov    %eax,-0x23(%rbp)
mov    0xddd(%rip),%al
mov    %al,-0x1f(%rbp)
lea    -0x23(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rsi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr9751>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movb   $0x0,0x2(%rsp)
movw   $0x7325,(%rsp)
lea    0xec7(%rip),%rbx
mov    %rsp,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movb   $0x0,0x20(%rsp)
movl   $0x70332e25,0x1c(%rsp)
70
lea    0xe98(%rip),%rbx
lea    0x1c(%rsp),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x733025,0x24(%rsp)
lea    0xe78(%rip),%rbx
lea    0x24(%rsp),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe64(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movb   $0x0,0x18(%rsp)
movl   $0x73686825,0x14(%rsp)
73
lea    0xe4a(%rip),%r14
lea    0x14(%rsp),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movb   $0x0,0x10(%rsp)
movl   $0x64302d25,0xc(%rsp)
64
lea    0xe1f(%rip),%rbx
lea    0xc(%rsp),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movb   $0x0,0x8(%rsp)
movl   $0x64303025,0x4(%rsp)
64
lea    0xdf0(%rip),%rbx
lea    0x4(%rsp),%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@__const.pr9751.kFormat1 = [3 x i8] c"%s\00"
@.str = [3 x i8] c"%s\00"
@__const.pr9751.kFormat2 = [5 x i8] c"%.3p\00"
@.str.1 = [5 x i8] c"%.3p\00"
@__const.pr9751.kFormat3 = [4 x i8] c"%0s\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [4 x i8] c"%0s\00"
@__const.pr9751.kFormat4 = [5 x i8] c"%hhs\00"
@.str.4 = [5 x i8] c"%hhs\00"
@__const.pr9751.kFormat5 = [5 x i8] c"%-0d\00"
@.str.5 = [5 x i8] c"%-0d\00"
@__const.pr9751.kFormat6 = [5 x i8] c"%00d\00"
@.str.6 = [5 x i8] c"%00d\00"
define void @pr9751() {
%1 = alloca [3 x i8]
%2 = alloca [5 x i8]
%3 = alloca i8*
%4 = alloca [4 x i8]
%5 = alloca [5 x i8]
%6 = alloca [5 x i8]
%7 = alloca [5 x i8]
%8 = alloca i32*
%9 = bitcast [3 x i8]* %1 to i8*
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* %10, i32 5)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 5)
%13 = bitcast [5 x i8]* %2 to i8*
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%15 = load i8*, i8** %3
%16 = call i32 (i8*, ...) @printf(i8* %14, i8* %15)
%17 = load i8*, i8** %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = bitcast [4 x i8]* %4 to i8*
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = bitcast [5 x i8]* %5 to i8*
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = bitcast [5 x i8]* %6 to i8*
%28 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* %28, i32 5)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 5)
%31 = bitcast [5 x i8]* %7 to i8*
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%33 = load i32*, i32** %8
%34 = call i32 (i8*, ...) @scanf(i8* %32, i32* %33)
%35 = load i32*, i32** %8
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32* %35)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"%.3p\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [4 x i8] c"%0s\00"
@.str.4 = [5 x i8] c"%hhs\00"
@.str.5 = [5 x i8] c"%-0d\00"
@.str.6 = [5 x i8] c"%00d\00"
define void @pr9751() {
%1 = alloca [3 x i8]
%2 = alloca [5 x i8]
%3 = alloca i32
%4 = alloca [5 x i8]
%5 = alloca [5 x i8]
%6 = alloca [5 x i8]
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* %7, i32 5)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 5)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* %10, i8* undef)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* undef)
%13 = bitcast i32* %3 to i8*
store i32 7548965, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* %19, i32 5)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 5)
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%23 = call i32 (i8*, ...) @scanf(i8* %22, i32* undef)
%24 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32* undef)
ret void
}