#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*/ puts(char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *, ...);
int strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char buf[100];
  int point, x, y;
  int status = 0;
  sscanf("0x10 10", "%x %x", &x, &y);
  sprintf(buf, "%d %d", x, y);
  puts(buf);
  status |= strcmp(buf, "16 16");
  sscanf("P012349876", "P%1d%4d%4d", &point, &x, &y);
  sprintf(buf, "%d %d %d", point, x, y);
  status |= strcmp(buf, "0 1234 9876");
  puts(buf);
  sscanf("P112349876", "P%1d%4d%4d", &point, &x, &y);
  sprintf(buf, "%d %d %d", point, x, y);
  status |= strcmp(buf, "1 1234 9876");
  puts(buf);
  puts(status ? "Test failed" : "Test passed");
  return status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x90(%rbp)
lea    0xe96(%rip),%rdi
lea    0xe97(%rip),%rsi
lea    -0x88(%rbp),%rdx
lea    -0x8c(%rbp),%rcx
mov    $0x0,%al
call   1050 <sscanf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x88(%rbp),%edx
mov    -0x8c(%rbp),%ecx
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x80(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1040 <strcmp@plt>
or     -0x90(%rbp),%eax
mov    %eax,-0x90(%rbp)
lea    0xe44(%rip),%rdi
lea    0xe48(%rip),%rsi
lea    -0x84(%rbp),%rdx
lea    -0x88(%rbp),%rcx
lea    -0x8c(%rbp),%r8
mov    $0x0,%al
call   1050 <sscanf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
mov    -0x8c(%rbp),%r8d
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x80(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   1040 <strcmp@plt>
or     -0x90(%rbp),%eax
mov    %eax,-0x90(%rbp)
lea    -0x80(%rbp),%rdi
call   1030 <puts@plt>
lea    0xdfb(%rip),%rdi
lea    0xdd4(%rip),%rsi
lea    -0x84(%rbp),%rdx
lea    -0x88(%rbp),%rcx
lea    -0x8c(%rbp),%r8
mov    $0x0,%al
call   1050 <sscanf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%edx
mov    -0x88(%rbp),%ecx
mov    -0x8c(%rbp),%r8d
lea    0xda5(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x80(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1040 <strcmp@plt>
or     -0x90(%rbp),%eax
mov    %eax,-0x90(%rbp)
lea    -0x80(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x90(%rbp),%ecx
lea    0xda4(%rip),%rdi
lea    0xd91(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <puts@plt>
mov    -0x90(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xeab(%rip),%rdi
lea    0xeac(%rip),%rsi
lea    0x4(%rsp),%rbp
lea    0x8(%rsp),%rbx
mov    %rbp,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xeab(%rip),%rsi
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xe6e(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
mov    %eax,%r15d
lea    0xe62(%rip),%rdi
lea    0xe66(%rip),%rsi
lea    0xc(%rsp),%r13
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    0xc(%rsp),%edx
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%r8d
lea    0xe48(%rip),%r14
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <sprintf@plt>
lea    0xe3d(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
mov    %eax,%ebp
or     %r15d,%ebp
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xe2d(%rip),%rdi
lea    0xe06(%rip),%rsi
mov    %r13,%rdx
lea    0x4(%rsp),%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    0xc(%rsp),%edx
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <sprintf@plt>
lea    0xdfe(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1030 <puts@plt>
or     %ebp,%ebx
lea    0xdfb(%rip),%rax
lea    0xde8(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"0x10 10\00"
@.str.1 = [6 x i8] c"%x %x\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [6 x i8] c"16 16\00"
@.str.4 = [11 x i8] c"P012349876\00"
@.str.5 = [11 x i8] c"P%1d%4d%4d\00"
@.str.6 = [9 x i8] c"%d %d %d\00"
@.str.7 = [12 x i8] c"0 1234 9876\00"
@.str.8 = [11 x i8] c"P112349876\00"
@.str.9 = [12 x i8] c"1 1234 9876\00"
@.str.10 = [12 x i8] c"Test failed\00"
@.str.11 = [12 x i8] c"Test passed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%11 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %8, i32* %9)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%17 = call i32 @puts(i8* %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* %10
%21 = or i32 %20, %19
store i32 %21, i32* %10
%22 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32* %7, i32* %8, i32* %9)
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = load i32, i32* %9
%27 = call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %24, i32 %25, i32 %26)
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%30 = load i32, i32* %10
%31 = or i32 %30, %29
store i32 %31, i32* %10
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%33 = call i32 @puts(i8* %32)
%34 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32* %7, i32* %8, i32* %9)
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%36 = load i32, i32* %7
%37 = load i32, i32* %8
%38 = load i32, i32* %9
%39 = call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %36, i32 %37, i32 %38)
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%41 = call i32 @strcmp(i8* %40, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%42 = load i32, i32* %10
%43 = or i32 %42, %41
store i32 %43, i32* %10
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%45 = call i32 @puts(i8* %44)
%46 = load i32, i32* %10
%47 = icmp ne i32 %46, 0
%48 = zext i1 %47 to i64
%49 = select i1 %47, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0)
%50 = call i32 @puts(i8* %49)
%51 = load i32, i32* %10
ret i32 %51
}

LLVM IR (-O2):
@.str = [8 x i8] c"0x10 10\00"
@.str.1 = [6 x i8] c"%x %x\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [6 x i8] c"16 16\00"
@.str.4 = [11 x i8] c"P012349876\00"
@.str.5 = [11 x i8] c"P%1d%4d%4d\00"
@.str.6 = [9 x i8] c"%d %d %d\00"
@.str.7 = [12 x i8] c"0 1234 9876\00"
@.str.8 = [11 x i8] c"P112349876\00"
@.str.9 = [12 x i8] c"1 1234 9876\00"
@.str.10 = [12 x i8] c"Test failed\00"
@.str.11 = [12 x i8] c"Test passed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13)
%15 = call i32 @puts(i8* %7)
%16 = call i32 @strcmp(i8* %7, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %18, i32 %19, i32 %20)
%22 = call i32 @strcmp(i8* %7, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%23 = or i32 %22, %16
%24 = call i32 @puts(i8* %7)
%25 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %26, i32 %27, i32 %28)
%30 = call i32 @strcmp(i8* %7, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%31 = or i32 %23, %30
%32 = call i32 @puts(i8* %7)
%33 = icmp eq i32 %31, 0
%34 = select i1 %33, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0)
%35 = call i32 @puts(i8* dereferenceable(1) %34)
ret i32 %31
}