#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 sscanf(char *, char *, int *);
int main(int argc, char **argv, char **env) {
  int v;
  int r = sscanf("0x00A", "%x", &v);
  if (v != 10 || r != 1) {
    return 1;
  }
  r = sscanf("0xc9", "%x", &v);
  if (v != 201 || r != 1) {
    return 2;
  }
  r = sscanf("0xF0", "%x", &v);
  if (v != 240 || r != 1) {
    return 3;
  }
  r = sscanf("0xFF", "%x", &v);
  if (v != 255 || r != 1) {
    return 4;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xecf(%rip),%rdi
lea    0xece(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <sscanf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jne    1158 <main+0x48>
cmpl   $0x1,-0x20(%rbp)
je     1164 <main+0x54>
movl   $0x1,-0x4(%rbp)
jmp    1222 <main+0x112>
lea    0xe9e(%rip),%rdi
lea    0xe94(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <sscanf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xc9,-0x1c(%rbp)
jne    1195 <main+0x85>
cmpl   $0x1,-0x20(%rbp)
je     11a1 <main+0x91>
movl   $0x2,-0x4(%rbp)
jmp    1222 <main+0x112>
lea    0xe66(%rip),%rdi
lea    0xe57(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <sscanf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xf0,-0x1c(%rbp)
jne    11d2 <main+0xc2>
cmpl   $0x1,-0x20(%rbp)
je     11de <main+0xce>
movl   $0x3,-0x4(%rbp)
jmp    1222 <main+0x112>
lea    0xe2e(%rip),%rdi
lea    0xe1a(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <sscanf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xff,-0x1c(%rbp)
jne    120f <main+0xff>
cmpl   $0x1,-0x20(%rbp)
je     121b <main+0x10b>
movl   $0x4,-0x4(%rbp)
jmp    1222 <main+0x112>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee7(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
jne    11d0 <main+0xc0>
cmpl   $0xa,0x4(%rsp)
jne    11d0 <main+0xc0>
lea    0xebe(%rip),%rdi
lea    0xeb4(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    $0x1,%ecx
jne    11d0 <main+0xc0>
cmpl   $0xc9,0x4(%rsp)
jne    11d0 <main+0xc0>
lea    0xe95(%rip),%rdi
lea    0xe86(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    $0x1,%ecx
jne    11d0 <main+0xc0>
cmpl   $0xf0,0x4(%rsp)
jne    11d0 <main+0xc0>
lea    0xe6c(%rip),%rdi
lea    0xe58(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0xff,%edx
xor    0x4(%rsp),%edx
xor    $0x1,%ecx
xor    %eax,%eax
or     %edx,%ecx
setne  %al
shl    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"0x00A\00"
@.str.1 = [3 x i8] c"%x\00"
@.str.2 = [5 x i8] c"0xc9\00"
@.str.3 = [5 x i8] c"0xF0\00"
@.str.4 = [5 x i8] c"0xFF\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%10 = call i32 @sscanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i32 %10, i32* %9
%11 = load i32, i32* %8
%12 = icmp ne i32 %11, 10
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load i32, i32* %9
%15 = icmp ne i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %13, %3
store i32 1, i32* %4
br label %42
17: ; preds = %13
%18 = call i32 @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i32 %18, i32* %9
%19 = load i32, i32* %8
%20 = icmp ne i32 %19, 201
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = load i32, i32* %9
%23 = icmp ne i32 %22, 1
br i1 %23, label %24, label %25
24: ; preds = %21, %17
store i32 2, i32* %4
br label %42
25: ; preds = %21
%26 = call i32 @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i32 %26, i32* %9
%27 = load i32, i32* %8
%28 = icmp ne i32 %27, 240
br i1 %28, label %32, label %29
29: ; preds = %25
%30 = load i32, i32* %9
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %33
32: ; preds = %29, %25
store i32 3, i32* %4
br label %42
33: ; preds = %29
%34 = call i32 @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i32 %34, i32* %9
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 255
br i1 %36, label %40, label %37
37: ; preds = %33
%38 = load i32, i32* %9
%39 = icmp ne i32 %38, 1
br i1 %39, label %40, label %41
40: ; preds = %37, %33
store i32 4, i32* %4
br label %42
41: ; preds = %37
store i32 0, i32* %4
br label %42
42: ; preds = %41, %40, %32, %24, %16
%43 = load i32, i32* %4
ret i32 %43
}

LLVM IR (-O2):
@.str = [6 x i8] c"0x00A\00"
@.str.1 = [3 x i8] c"%x\00"
@.str.2 = [5 x i8] c"0xc9\00"
@.str.3 = [5 x i8] c"0xF0\00"
@.str.4 = [5 x i8] c"0xFF\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @sscanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 10
%9 = icmp ne i32 %6, 1
%10 = or i1 %9, %8
br i1 %10, label %30, label %11
11: ; preds = %3
%12 = call i32 @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 201
%15 = icmp ne i32 %12, 1
%16 = or i1 %15, %14
br i1 %16, label %30, label %17
17: ; preds = %11
%18 = call i32 @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 240
%21 = icmp ne i32 %18, 1
%22 = or i1 %21, %20
br i1 %22, label %30, label %23
23: ; preds = %17
%24 = call i32 @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 255
%27 = icmp ne i32 %24, 1
%28 = or i1 %27, %26
%29 = select i1 %28, i32 4, i32 0
br label %30
30: ; preds = %23, %17, %11, %3
%31 = phi i32 [ 1, %3 ], [ 2, %11 ], [ 3, %17 ], [ %29, %23 ]
ret i32 %31
}