#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*/ miniscanf(char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  printf("integer, double, string and char \n");
  int val;
  miniscanf("%d", &val);
  printf("case 1: integer is %d\n", val);
  double dval;
  miniscanf("%f", &dval);
  printf("case 2: double is %g\n", dval);
  char buf[128];
  miniscanf("%s", buf);
  printf("case 3: string is %s\n", buf);
  char ch;
  miniscanf("%c", &ch);
  printf("case 4: char is %c\n", ch);
  printf("together\n");
  miniscanf("%d %f %s %c", &val, &dval, buf, &ch);
  printf("int: %d f: %g str: %s ch: %c\n", val, dval, buf, ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <miniscanf@plt>
mov    -0x14(%rbp),%esi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <miniscanf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xeb8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rsi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <miniscanf@plt>
lea    -0xa0(%rbp),%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0xa1(%rbp),%rsi
mov    $0x0,%al
call   1040 <miniscanf@plt>
movsbl -0xa1(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rcx
lea    0xe8e(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0xa1(%rbp),%r8
mov    $0x0,%al
call   1040 <miniscanf@plt>
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    -0xa0(%rbp),%rdx
movsbl -0xa1(%rbp),%ecx
lea    0xe67(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xf45(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
lea    0x4(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <miniscanf@plt>
mov    0x4(%rsp),%esi
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
lea    0x8(%rsp),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <miniscanf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xe88(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <miniscanf@plt>
lea    0xe7d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    0x3(%rsp),%r12
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <miniscanf@plt>
movsbl 0x3(%rsp),%esi
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe61(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1050 <miniscanf@plt>
mov    0x4(%rsp),%esi
movsd  0x8(%rsp),%xmm0
movsbl 0x3(%rsp),%ecx
lea    0xe44(%rip),%rdi
mov    %rbx,%rdx
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"integer, double, string and char \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"case 1: integer is %d\0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [22 x i8] c"case 2: double is %g\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [22 x i8] c"case 3: string is %s\0A\00"
@.str.7 = [3 x i8] c"%c\00"
@.str.8 = [20 x i8] c"case 4: char is %c\0A\00"
@.str.9 = [10 x i8] c"together\0A\00"
@.str.10 = [12 x i8] c"%d %f %s %c\00"
@.str.11 = [30 x i8] c"int: %d f: %g str: %s ch: %c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca [128 x i8]
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%12 = load i32, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), double* %7)
%15 = load double, double* %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %15)
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%18 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %19)
%21 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %9)
%22 = load i8, i8* %9
%23 = sext i8 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%27 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32* %6, double* %7, i8* %26, i8* %9)
%28 = load i32, i32* %6
%29 = load double, double* %7
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%31 = load i8, i8* %9
%32 = sext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i32 %28, double %29, i8* %30, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"case 1: integer is %d\0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [22 x i8] c"case 2: double is %g\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [22 x i8] c"case 3: string is %s\0A\00"
@.str.7 = [3 x i8] c"%c\00"
@.str.8 = [20 x i8] c"case 4: char is %c\0A\00"
@.str.10 = [12 x i8] c"%d %f %s %c\00"
@.str.11 = [30 x i8] c"int: %d f: %g str: %s ch: %c\0A\00"
@str = [34 x i8] c"integer, double, string and char \00"
@str.12 = [9 x i8] c"together\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca [128 x i8]
%6 = alloca i8
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%8 = bitcast i32* %3 to i8*
%9 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = bitcast double* %4 to i8*
%13 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), double* %4)
%14 = load double, double* %4
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %14)
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%17 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %16)
%19 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %6)
%20 = load i8, i8* %6
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %21)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0))
%24 = call i32 (i8*, ...) @miniscanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32* %3, double* %4, i8* %16, i8* %6)
%25 = load i32, i32* %3
%26 = load double, double* %4
%27 = load i8, i8* %6
%28 = sext i8 %27 to i32
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i32 %25, double %26, i8* %16, i32 %28)
ret i32 0
}