#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*/ printf(char *, ...);
void bug7377_bad_length_mod_usage() {
  printf("%hhs", "foo");
  printf("%1$zp", (void *)0);
  printf("%ls", L"foo");
  printf("%#.2Lf", (long double)1.234);
  printf("%#p", (void *)0);
  printf("%0d", -1);
  printf("%#n", (void *)0);
  printf("%-n", (void *)0);
  printf("%-p", (void *)0);
  printf("%.2c", 'a');
  printf("%1n", (void *)0);
  printf("%.9n", (void *)0);
  printf("% +f", 1.23);
  printf("%+ f", 1.23);
  printf("%0-f", 1.23);
  printf("%-0f", 1.23);
  printf("%-+f", 1.23);
}


x86 assembly (clang, -O0):
<bug7377_bad_length_mod_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xef1(%rip),%rdi
lea    0xeef(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0xf1b(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %rsp,%rax
fldl   0xeab(%rip)
fstpt  (%rax)
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7d(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    $0x61,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
movsd  0xdf2(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe35(%rip),%rdi
movsd  0xddc(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
movsd  0xdc6(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe13(%rip),%rdi
movsd  0xdb0(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe02(%rip),%rdi
movsd  0xd9a(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bug7377_bad_length_mod_usage>:
sub    $0x18,%rsp
lea    0xef5(%rip),%rdi
lea    0xef3(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0xf21(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
fldl   0xeac(%rip)
fstpt  (%rsp)
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
mov    $0x61,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
movsd  0xe0e(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
movsd  0xdf8(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
movsd  0xde2(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe27(%rip),%rdi
movsd  0xdcc(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe16(%rip),%rdi
movsd  0xdb6(%rip),%xmm0
mov    $0x1,%al
add    $0x18,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%hhs\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [6 x i8] c"%1$zp\00"
@.str.3 = [4 x i8] c"%ls\00"
@.str.4 = [4 x i32] [i32 102, i32 111, i32 111, i32 0]
@.str.5 = [7 x i8] c"%#.2Lf\00"
@.str.6 = [4 x i8] c"%#p\00"
@.str.7 = [4 x i8] c"%0d\00"
@.str.8 = [4 x i8] c"%#n\00"
@.str.9 = [4 x i8] c"%-n\00"
@.str.10 = [4 x i8] c"%-p\00"
@.str.11 = [5 x i8] c"%.2c\00"
@.str.12 = [4 x i8] c"%1n\00"
@.str.13 = [5 x i8] c"%.9n\00"
@.str.14 = [5 x i8] c"% +f\00"
@.str.15 = [5 x i8] c"%+ f\00"
@.str.16 = [5 x i8] c"%0-f\00"
@.str.17 = [5 x i8] c"%-0f\00"
@.str.18 = [5 x i8] c"%-+f\00"
define void @bug7377_bad_length_mod_usage() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* null)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* getelementptr inbounds ([4 x i32], [4 x i32]* @.str.4, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), x86_fp80 0xK3FFF9DF3B645A1CAC000)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* null)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 -1)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* null)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* null)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* null)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 97)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* null)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* null)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), double 1.230000e+00)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), double 1.230000e+00)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), double 1.230000e+00)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), double 1.230000e+00)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), double 1.230000e+00)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%hhs\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [6 x i8] c"%1$zp\00"
@.str.3 = [4 x i8] c"%ls\00"
@.str.4 = [4 x i32] [i32 102, i32 111, i32 111, i32 0]
@.str.5 = [7 x i8] c"%#.2Lf\00"
@.str.6 = [4 x i8] c"%#p\00"
@.str.7 = [4 x i8] c"%0d\00"
@.str.8 = [4 x i8] c"%#n\00"
@.str.9 = [4 x i8] c"%-n\00"
@.str.10 = [4 x i8] c"%-p\00"
@.str.11 = [5 x i8] c"%.2c\00"
@.str.12 = [4 x i8] c"%1n\00"
@.str.13 = [5 x i8] c"%.9n\00"
@.str.14 = [5 x i8] c"% +f\00"
@.str.15 = [5 x i8] c"%+ f\00"
@.str.16 = [5 x i8] c"%0-f\00"
@.str.17 = [5 x i8] c"%-0f\00"
@.str.18 = [5 x i8] c"%-+f\00"
define void @bug7377_bad_length_mod_usage() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* null)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* getelementptr inbounds ([4 x i32], [4 x i32]* @.str.4, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), x86_fp80 0xK3FFF9DF3B645A1CAC000)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* null)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 -1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* null)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* null)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* null)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 97)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* null)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* null)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), double 1.230000e+00)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), double 1.230000e+00)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), double 1.230000e+00)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), double 1.230000e+00)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), double 1.230000e+00)
ret void
}