#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ sbcs_scan_hex32_(char const **, int /*<<< orphan*/ *);
scalar_t__ sbcs_scan_is_eol_(char const *);
int /*<<< orphan*/ sbcs_scan_spaces_(char const **);
size_t sbcs_scan_map_(const char *const line, uint32_t *from, uint32_t *to) {
  const char *p = line;
  sbcs_scan_spaces_(&p);
  if (!sbcs_scan_hex32_(&p, from)) {
    return 0;
  }
  sbcs_scan_spaces_(&p);
  if (sbcs_scan_is_eol_(p)) {
    return 1;
  }
  if (!sbcs_scan_hex32_(&p, to)) {
    return 0;
  }
  sbcs_scan_spaces_(&p);
  if (!sbcs_scan_is_eol_(p)) {
    return 0;
  }
  return 2;
}


x86 assembly (clang, -O0):
<sbcs_scan_map_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
call   1030 <sbcs_scan_spaces_@plt>
mov    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdi
call   1040 <sbcs_scan_hex32_@plt>
cmp    $0x0,%eax
jne    1178 <sbcs_scan_map_+0x48>
movq   $0x0,-0x8(%rbp)
jmp    11f5 <sbcs_scan_map_+0xc5>
lea    -0x28(%rbp),%rdi
call   1030 <sbcs_scan_spaces_@plt>
mov    -0x28(%rbp),%rdi
call   1050 <sbcs_scan_is_eol_@plt>
cmp    $0x0,%rax
je     11a1 <sbcs_scan_map_+0x71>
movq   $0x1,-0x8(%rbp)
jmp    11f5 <sbcs_scan_map_+0xc5>
mov    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdi
call   1040 <sbcs_scan_hex32_@plt>
cmp    $0x0,%eax
jne    11c4 <sbcs_scan_map_+0x94>
movq   $0x0,-0x8(%rbp)
jmp    11f5 <sbcs_scan_map_+0xc5>
lea    -0x28(%rbp),%rdi
call   1030 <sbcs_scan_spaces_@plt>
mov    -0x28(%rbp),%rdi
call   1050 <sbcs_scan_is_eol_@plt>
cmp    $0x0,%rax
jne    11ed <sbcs_scan_map_+0xbd>
movq   $0x0,-0x8(%rbp)
jmp    11f5 <sbcs_scan_map_+0xc5>
movq   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbcs_scan_map_>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%r15
mov    %r15,%rdi
call   1030 <sbcs_scan_spaces_@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <sbcs_scan_hex32_@plt>
test   %eax,%eax
je     11b6 <sbcs_scan_map_+0x86>
lea    0x8(%rsp),%rdi
call   1030 <sbcs_scan_spaces_@plt>
mov    0x8(%rsp),%rdi
call   1050 <sbcs_scan_is_eol_@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    11b8 <sbcs_scan_map_+0x88>
lea    0x8(%rsp),%rdi
mov    %r14,%rsi
call   1040 <sbcs_scan_hex32_@plt>
test   %eax,%eax
je     11b6 <sbcs_scan_map_+0x86>
lea    0x8(%rsp),%rdi
call   1030 <sbcs_scan_spaces_@plt>
mov    0x8(%rsp),%rdi
call   1050 <sbcs_scan_is_eol_@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    %rax,%rax
jmp    11b8 <sbcs_scan_map_+0x88>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @sbcs_scan_map_(i8* %0, i32* %1, i32* %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%9 = load i8*, i8** %5
store i8* %9, i8** %8
%10 = call i32 @sbcs_scan_spaces_(i8** %8)
%11 = load i32*, i32** %6
%12 = call i32 @sbcs_scan_hex32_(i8** %8, i32* %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %3
store i64 0, i64* %4
br label %33
15: ; preds = %3
%16 = call i32 @sbcs_scan_spaces_(i8** %8)
%17 = load i8*, i8** %8
%18 = call i64 @sbcs_scan_is_eol_(i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i64 1, i64* %4
br label %33
21: ; preds = %15
%22 = load i32*, i32** %7
%23 = call i32 @sbcs_scan_hex32_(i8** %8, i32* %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21
store i64 0, i64* %4
br label %33
26: ; preds = %21
%27 = call i32 @sbcs_scan_spaces_(i8** %8)
%28 = load i8*, i8** %8
%29 = call i64 @sbcs_scan_is_eol_(i8* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %26
store i64 0, i64* %4
br label %33
32: ; preds = %26
store i64 2, i64* %4
br label %33
33: ; preds = %32, %31, %25, %20, %14
%34 = load i64, i64* %4
ret i64 %34
}

LLVM IR (-O2):
define i64 @sbcs_scan_map_(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
store i8* %0, i8** %4
%6 = call i32 @sbcs_scan_spaces_(i8** %4)
%7 = call i32 @sbcs_scan_hex32_(i8** %4, i32* %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %23, label %9
9: ; preds = %3
%10 = call i32 @sbcs_scan_spaces_(i8** %4)
%11 = load i8*, i8** %4
%12 = call i64 @sbcs_scan_is_eol_(i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %9
%15 = call i32 @sbcs_scan_hex32_(i8** %4, i32* %2)
%16 = icmp eq i32 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = call i32 @sbcs_scan_spaces_(i8** %4)
%19 = load i8*, i8** %4
%20 = call i64 @sbcs_scan_is_eol_(i8* %19)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i64 0, i64 2
br label %23
23: ; preds = %17, %14, %9, %3
%24 = phi i64 [ 0, %3 ], [ 1, %9 ], [ 0, %14 ], [ %22, %17 ]
ret i64 %24
}