#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*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int, ...);
int scanf(char *, int *, unsigned short *, double *, int *);
int main() {
  int a = 0;
  int n = 0;
  int cn = 0;
  int pn = 0;
  unsigned short b = 0;
  double f = 0;
  char s[12];
  memset(s, 0, 12);
  cn = scanf(" %2d, %1hu, %lf%n", &a, &b, &f, &n);
  printf("%#-+7.4x, %#e, %hu, n %d, cn = %d, %n\n", a, f, b, n, cn, &pn);
  printf("pn %d\n", pn);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movw   $0x0,-0x16(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x2c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
lea    0xe80(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x16(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0xc(%rbp),%r8
call   1050 <scanf@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movzwl -0x16(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe60(%rip),%rdi
lea    -0x14(%rbp),%r9
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movw   $0x0,0x2(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x1c(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
lea    0xe8c(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x2(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
movsd  0x10(%rsp),%xmm0
movzwl 0x2(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xe6b(%rip),%rdi
lea    0x4(%rsp),%r9
mov    %eax,%r8d
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c" %2d, %1hu, %lf%n\00"
@.str.1 = [39 x i8] c"%#-+7.4x, %#e, %hu, n %d, cn = %d, %n\0A\00"
@.str.2 = [7 x i8] c"pn %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i16
%7 = alloca double
%8 = alloca [12 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i16 0, i16* %6
store double 0.000000e+00, double* %7
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i32 0, i32 12)
%11 = call i32 @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %2, i16* %6, double* %7, i32* %3)
store i32 %11, i32* %4
%12 = load i32, i32* %2
%13 = load double, double* %7
%14 = load i16, i16* %6
%15 = zext i16 %14 to i32
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %12, double %13, i32 %15, i32 %16, i32 %17, i32* %5)
%19 = load i32, i32* %5
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c" %2d, %1hu, %lf%n\00"
@.str.1 = [39 x i8] c"%#-+7.4x, %#e, %hu, n %d, cn = %d, %n\0A\00"
@.str.2 = [7 x i8] c"pn %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i16
%5 = alloca double
%6 = alloca [12 x i8]
%7 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%8 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%9 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%10 = bitcast i16* %4 to i8*
store i16 0, i16* %4
%11 = bitcast double* %5 to i8*
store double 0.000000e+00, double* %5
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%13 = call i32 @memset(i8* %12, i32 0, i32 12)
%14 = call i32 @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %1, i16* %4, double* %5, i32* %2)
%15 = load i32, i32* %1
%16 = load double, double* %5
%17 = load i16, i16* %4
%18 = zext i16 %17 to i32
%19 = load i32, i32* %2
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %15, double %16, i32 %18, i32 %19, i32 %14, i32* %3)
%21 = load i32, i32* %3
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %21)
ret i32 0
}