#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*/ scanf(char const *, ...);
void test(const char *s, int *i) {
  scanf(s, i);
  scanf("%0d", i);
  scanf("%00d", i);
  scanf("%d%[asdfasdfd", i, s);
  unsigned short s_x;
  scanf("%"
        "hu"
        "\n",
        &s_x);
  scanf("%y", i);
  scanf("%%");
  scanf("%%%1$d", i);
  scanf("%1$d%%", i);
  scanf("%d", i, i);
  scanf("%*d", i);
  scanf("%*d", i);
  scanf("%*d%1$d", i);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
lea    0xea7(%rip),%rdi
lea    -0x12(%rbp),%rsi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xecb(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xeb9(%rip),%rdi
lea    0x6(%rsp),%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xe8f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xe85(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xe6a(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xe4d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%0d\00"
@.str.1 = [5 x i8] c"%00d\00"
@.str.2 = [14 x i8] c"%d%[asdfasdfd\00"
@.str.3 = [5 x i8] c"%hu\0A\00"
@.str.4 = [3 x i8] c"%y\00"
@.str.5 = [3 x i8] c"%%\00"
@.str.6 = [7 x i8] c"%%%1$d\00"
@.str.7 = [7 x i8] c"%1$d%%\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [4 x i8] c"%*d\00"
@.str.10 = [8 x i8] c"%*d%1$d\00"
define void @test(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i16
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = load i32*, i32** %4
%8 = call i32 (i8*, ...) @scanf(i8* %6, i32* %7)
%9 = load i32*, i32** %4
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = load i32*, i32** %4
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%13 = load i32*, i32** %4
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32* %13, i8* %14)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i16* %5)
%17 = load i32*, i32** %4
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %17)
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%20 = load i32*, i32** %4
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32* %20)
%22 = load i32*, i32** %4
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32* %22)
%24 = load i32*, i32** %4
%25 = load i32*, i32** %4
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %24, i32* %25)
%27 = load i32*, i32** %4
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32* %27)
%29 = load i32*, i32** %4
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32* %29)
%31 = load i32*, i32** %4
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32* %31)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%0d\00"
@.str.1 = [5 x i8] c"%00d\00"
@.str.2 = [14 x i8] c"%d%[asdfasdfd\00"
@.str.3 = [5 x i8] c"%hu\0A\00"
@.str.4 = [3 x i8] c"%y\00"
@.str.5 = [3 x i8] c"%%\00"
@.str.6 = [7 x i8] c"%%%1$d\00"
@.str.7 = [7 x i8] c"%1$d%%\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [4 x i8] c"%*d\00"
@.str.10 = [8 x i8] c"%*d%1$d\00"
define void @test(i8* %0, i32* %1) {
%3 = alloca i16
%4 = tail call i32 (i8*, ...) @scanf(i8* %0, i32* %1)
%5 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32* %1, i8* %0)
%8 = bitcast i16* %3 to i8*
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i16* %3)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1, i32* %1)
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32* %1)
ret void
}