#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 */
unsigned long long __make_mantissa_base10(char const *);
unsigned long long __make_mantissa_base16(char const *);
unsigned long long __make_mantissa_base8(char const *);
unsigned long long __make_mantissa(const char *tagp) {
  if (!tagp)
    return 0u;
  if (*tagp == '0') {
    ++tagp;
    if (*tagp == 'x' || *tagp == 'X')
      return __make_mantissa_base16(tagp);
    else
      return __make_mantissa_base8(tagp);
  }
  return __make_mantissa_base10(tagp);
}


x86 assembly (clang, -O0):
<__make_mantissa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <__make_mantissa+0x24>
movq   $0x0,-0x8(%rbp)
jmp    11c1 <__make_mantissa+0x91>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    11b4 <__make_mantissa+0x84>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
je     1190 <__make_mantissa+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x58,%eax
jne    11a2 <__make_mantissa+0x72>
mov    -0x10(%rbp),%rdi
call   1030 <__make_mantissa_base16@plt>
mov    %rax,-0x8(%rbp)
jmp    11c1 <__make_mantissa+0x91>
mov    -0x10(%rbp),%rdi
call   1050 <__make_mantissa_base8@plt>
mov    %rax,-0x8(%rbp)
jmp    11c1 <__make_mantissa+0x91>
mov    -0x10(%rbp),%rdi
call   1040 <__make_mantissa_base10@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__make_mantissa>:
test   %rdi,%rdi
je     114c <__make_mantissa+0x1c>
cmpb   $0x30,(%rdi)
jne    114f <__make_mantissa+0x1f>
mov    0x1(%rdi),%al
add    $0x1,%rdi
or     $0x20,%al
cmp    $0x78,%al
jne    1154 <__make_mantissa+0x24>
jmp    1030 <__make_mantissa_base16@plt>
xor    %eax,%eax
ret
jmp    1040 <__make_mantissa_base10@plt>
jmp    1050 <__make_mantissa_base8@plt>

LLVM IR (-O0):
define i64 @__make_mantissa(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i64 0, i64* %2
br label %33
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 48
br i1 %11, label %12, label %30
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 120
br i1 %18, label %24, label %19
19: ; preds = %12
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 88
br i1 %23, label %24, label %27
24: ; preds = %19, %12
%25 = load i8*, i8** %3
%26 = call i64 @__make_mantissa_base16(i8* %25)
store i64 %26, i64* %2
br label %33
27: ; preds = %19
%28 = load i8*, i8** %3
%29 = call i64 @__make_mantissa_base8(i8* %28)
store i64 %29, i64* %2
br label %33
30: ; preds = %7
%31 = load i8*, i8** %3
%32 = call i64 @__make_mantissa_base10(i8* %31)
store i64 %32, i64* %2
br label %33
33: ; preds = %30, %27, %24, %6
%34 = load i64, i64* %2
ret i64 %34
}

LLVM IR (-O2):
define i64 @__make_mantissa(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 48
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
switch i8 %8, label %11 [
i8 120, label %9
i8 88, label %9
]
9: ; preds = %6, %6
%10 = tail call i64 @__make_mantissa_base16(i8* %7)
br label %15
11: ; preds = %6
%12 = tail call i64 @__make_mantissa_base8(i8* %7)
br label %15
13: ; preds = %3
%14 = tail call i64 @__make_mantissa_base10(i8* %0)
br label %15
15: ; preds = %1, %13, %11, %9
%16 = phi i64 [ %10, %9 ], [ %12, %11 ], [ %14, %13 ], [ 0, %1 ]
ret i64 %16
}