#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, char *, int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
void check_invalid_specifier(FILE *fp, char *buf) {
  printf("%s%lb%d", "unix", 10, 20);
  fprintf(fp, "%%%l");
  sprintf(buf, "%%%%%ld%d%d", 1, 2, 3);
  snprintf(buf, 2, "%%%%%ld%;%d", 1, 2, 3);
}


x86 assembly (clang, -O0):
<check_invalid_specifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
lea    0xeaa(%rip),%rsi
mov    $0xa,%edx
mov    $0x14,%ecx
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
call   1060 <sprintf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%r8d
lea    0xe70(%rip),%rdx
mov    $0x1,%ecx
mov    $0x3,%r9d
mov    %r8d,%esi
call   1040 <snprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_invalid_specifier>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeaf(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0xa,%edx
mov    $0x14,%ecx
call   1030 <printf@plt>
lea    0xe9f(%rip),%rsi
mov    %r14,%rdi
call   1050 <fprintf@plt>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
call   1060 <sprintf@plt>
lea    0xe82(%rip),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%ecx
mov    $0x2,%r8d
mov    $0x3,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <snprintf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s%lb%d\00"
@.str.1 = [5 x i8] c"unix\00"
@.str.2 = [5 x i8] c"%%%l\00"
@.str.3 = [12 x i8] c"%%%%%ld%d%d\00"
@.str.4 = [12 x i8] c"%%%%%ld%;%d\00"
define void @check_invalid_specifier(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 20)
%6 = load i32*, i32** %3
%7 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = load i8*, i8** %4
%9 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 2, i32 3)
%10 = load i8*, i8** %4
%11 = call i32 @snprintf(i8* %10, i32 2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 2, i32 3)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s%lb%d\00"
@.str.1 = [5 x i8] c"unix\00"
@.str.2 = [5 x i8] c"%%%l\00"
@.str.3 = [12 x i8] c"%%%%%ld%d%d\00"
@.str.4 = [12 x i8] c"%%%%%ld%;%d\00"
define void @check_invalid_specifier(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 20)
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 2, i32 3)
%6 = tail call i32 @snprintf(i8* %1, i32 2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 2, i32 3)
ret void
}