#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*/ mcxErr(char *, char *, int, int);
int mcx_level_parsenum(int T, int c) {
  int r = -1;
  if (c == 'x')
    r = 0;
  else if (c >= '1' && c <= '9')
    r = ((int)c) - '0';
  else
    mcxErr("mcxLogLevelSetByString", "%c axis level [%c] parse error", (int)T,
           (int)c);
  return r;
}


x86 assembly (clang, -O0):
<mcx_level_parsenum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
cmpl   $0x78,-0x8(%rbp)
jne    113b <mcx_level_parsenum+0x2b>
movl   $0x0,-0xc(%rbp)
jmp    117b <mcx_level_parsenum+0x6b>
cmpl   $0x31,-0x8(%rbp)
jl     115d <mcx_level_parsenum+0x4d>
cmpl   $0x39,-0x8(%rbp)
jg     115d <mcx_level_parsenum+0x4d>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <mcx_level_parsenum+0x66>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe96(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1030 <mcxErr@plt>
jmp    117b <mcx_level_parsenum+0x6b>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcx_level_parsenum>:
xor    %eax,%eax
cmp    $0x78,%esi
je     1146 <mcx_level_parsenum+0x36>
mov    %esi,%ecx
lea    -0x31(%rcx),%eax
cmp    $0x8,%eax
ja     1127 <mcx_level_parsenum+0x17>
add    $0xffffffd0,%ecx
mov    %ecx,%eax
ret
push   %rax
mov    %edi,%edx
lea    0xecf(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1030 <mcxErr@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"mcxLogLevelSetByString\00"
@.str.1 = [31 x i8] c"%c axis level [%c] parse error\00"
define i32 @mcx_level_parsenum(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 -1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 120
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %5
br label %23
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp sge i32 %10, 49
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i32, i32* %4
%14 = icmp sle i32 %13, 57
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 48
store i32 %17, i32* %5
br label %22
18: ; preds = %12, %9
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @mcxErr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20)
br label %22
22: ; preds = %18, %15
br label %23
23: ; preds = %22, %8
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
@.str = [23 x i8] c"mcxLogLevelSetByString\00"
@.str.1 = [31 x i8] c"%c axis level [%c] parse error\00"
define i32 @mcx_level_parsenum(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 120
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = add i32 %1, -49
%6 = icmp ult i32 %5, 9
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = add nsw i32 %1, -48
br label %11
9: ; preds = %4
%10 = tail call i32 @mcxErr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %1)
br label %11
11: ; preds = %2, %7, %9
%12 = phi i32 [ %8, %7 ], [ -1, %9 ], [ 0, %2 ]
ret i32 %12
}