#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*/ minscanf(char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char sval[100] = "";
  int ival = 0;
  unsigned uval = 0;
  double dval = 0.0;
  printf("test of integer input ('%%d'): ");
  minscanf("%d", &ival);
  printf("received: %d\n", ival);
  printf("test of double input ('%%f'): ");
  minscanf("%f", &dval);
  printf("received: %f\n", dval);
  printf("test of string input ('%%s'): ");
  minscanf("%s", sval);
  printf("received: %s\n", sval);
  printf("test of hex input ('%%x'): ");
  minscanf("%x", &uval);
  printf("received: %x\n", uval);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0x74(%rbp),%rsi
mov    $0x0,%al
call   1050 <minscanf@plt>
mov    -0x74(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x0,%al
call   1050 <minscanf@plt>
movsd  -0x80(%rbp),%xmm0
lea    0xe8e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1050 <minscanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x78(%rbp),%rsi
mov    $0x0,%al
call   1050 <minscanf@plt>
mov    -0x78(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x70(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <minscanf@plt>
mov    0x4(%rsp),%esi
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <minscanf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <minscanf@plt>
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <minscanf@plt>
mov    (%rsp),%esi
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"test of integer input ('%%d'): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"received: %d\0A\00"
@.str.3 = [31 x i8] c"test of double input ('%%f'): \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [14 x i8] c"received: %f\0A\00"
@.str.6 = [31 x i8] c"test of string input ('%%s'): \00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [14 x i8] c"received: %s\0A\00"
@.str.9 = [28 x i8] c"test of hex input ('%%x'): \00"
@.str.10 = [3 x i8] c"%x\00"
@.str.11 = [14 x i8] c"received: %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
%6 = bitcast [100 x i8]* %2 to i8*
store i32 0, i32* %3
store i32 0, i32* %4
store double 0.000000e+00, double* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @minscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @minscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double* %5)
%13 = load double, double* %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = call i32 (i8*, ...) @minscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%21 = call i32 (i8*, ...) @minscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"test of integer input ('%%d'): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"received: %d\0A\00"
@.str.3 = [31 x i8] c"test of double input ('%%f'): \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [14 x i8] c"received: %f\0A\00"
@.str.6 = [31 x i8] c"test of string input ('%%s'): \00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [14 x i8] c"received: %s\0A\00"
@.str.9 = [28 x i8] c"test of hex input ('%%x'): \00"
@.str.10 = [3 x i8] c"%x\00"
@.str.11 = [14 x i8] c"received: %x\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @minscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @minscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double* %4)
%15 = load double, double* %4
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 (i8*, ...) @minscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %5)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %5)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%21 = call i32 (i8*, ...) @minscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %3)
%22 = load i32, i32* %3
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 %22)
ret i32 0
}