#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 *, double);
int /*<<< orphan*/ scanf(char *, ...);
void foo(char **sp, float *fp, int *ip) {
  scanf("%as", sp);
  scanf("%a[abc]", sp);
  scanf("%a", fp);
  scanf("%afoobar", fp);
  printf("%a", 1.0);
  printf("%as", 1.0);
  printf("%aS", 1.0);
  printf("%a[", 1.0);
  printf("%afoo", 1.0);
  scanf("%da", ip);
  scanf("%as", fp);
  scanf("%aS", fp);
  scanf("%a[abc]", fp);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe91(%rip),%rdi
movsd  0xe75(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
movsd  0xe61(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
movsd  0xe4d(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
movsd  0xe39(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
movsd  0xe25(%rip),%xmm0
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xecd(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xebd(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeb1(%rip),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xea0(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0xe77(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
movsd  0xe64(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe78(%rip),%r13
mov    %r13,%rdi
movsd  0xe4d(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
movsd  0xe39(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
movsd  0xe25(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe47(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%as\00"
@.str.1 = [8 x i8] c"%a[abc]\00"
@.str.2 = [3 x i8] c"%a\00"
@.str.3 = [9 x i8] c"%afoobar\00"
@.str.4 = [4 x i8] c"%aS\00"
@.str.5 = [4 x i8] c"%a[\00"
@.str.6 = [6 x i8] c"%afoo\00"
@.str.7 = [4 x i8] c"%da\00"
define void @foo(i8** %0, float* %1, i32* %2) {
%4 = alloca i8**
%5 = alloca float*
%6 = alloca i32*
store i8** %0, i8*** %4
store float* %1, float** %5
store i32* %2, i32** %6
%7 = load i8**, i8*** %4
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %7)
%9 = load i8**, i8*** %4
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %9)
%11 = load float*, float** %5
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %11)
%13 = load float*, float** %5
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), float* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), double 1.000000e+00)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double 1.000000e+00)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double 1.000000e+00)
%19 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), double 1.000000e+00)
%20 = load i32*, i32** %6
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32* %20)
%22 = load float*, float** %5
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %22)
%24 = load float*, float** %5
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), float* %24)
%26 = load float*, float** %5
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), float* %26)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%as\00"
@.str.1 = [8 x i8] c"%a[abc]\00"
@.str.2 = [3 x i8] c"%a\00"
@.str.3 = [9 x i8] c"%afoobar\00"
@.str.4 = [4 x i8] c"%aS\00"
@.str.5 = [4 x i8] c"%a[\00"
@.str.6 = [6 x i8] c"%afoo\00"
@.str.7 = [4 x i8] c"%da\00"
define void @foo(i8** %0, float* %1, i32* %2) {
%4 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %0)
%5 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %0)
%6 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%7 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), float* %1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), double 1.000000e+00)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double 1.000000e+00)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double 1.000000e+00)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), double 1.000000e+00)
%13 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32* %2)
%14 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %1)
%15 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), float* %1)
%16 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), float* %1)
ret void
}