#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 */
long get_ascii(char const **);
long get_dec(char const **);
long get_hex(char const **);
long get_num(const char **s) {
  if ((**s) == '$') {
    (*s)++;
    return get_hex(s);
  }
  if ((**s) == '\'') {
    (*s)++;
    return get_ascii(s);
  }
  return get_dec(s);
}


x86 assembly (clang, -O0):
<get_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
jne    116f <get_num+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
call   1050 <get_hex@plt>
mov    %rax,-0x8(%rbp)
jmp    11af <get_num+0x7f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    11a2 <get_num+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
call   1040 <get_ascii@plt>
mov    %rax,-0x8(%rbp)
jmp    11af <get_num+0x7f>
mov    -0x10(%rbp),%rdi
call   1030 <get_dec@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_num>:
mov    (%rdi),%rax
mov    (%rax),%cl
cmp    $0x27,%cl
je     114b <get_num+0x1b>
cmp    $0x24,%cl
jne    1157 <get_num+0x27>
add    $0x1,%rax
mov    %rax,(%rdi)
jmp    1050 <get_hex@plt>
add    $0x1,%rax
mov    %rax,(%rdi)
jmp    1040 <get_ascii@plt>
jmp    1030 <get_dec@plt>

LLVM IR (-O0):
define i64 @get_num(i8** %0) {
%2 = alloca i64
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = load i8**, i8*** %3
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 36
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %10
%13 = load i8**, i8*** %3
%14 = call i64 @get_hex(i8** %13)
store i64 %14, i64* %2
br label %30
15: ; preds = %1
%16 = load i8**, i8*** %3
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 39
br i1 %20, label %21, label %27
21: ; preds = %15
%22 = load i8**, i8*** %3
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %22
%25 = load i8**, i8*** %3
%26 = call i64 @get_ascii(i8** %25)
store i64 %26, i64* %2
br label %30
27: ; preds = %15
%28 = load i8**, i8*** %3
%29 = call i64 @get_dec(i8** %28)
store i64 %29, i64* %2
br label %30
30: ; preds = %27, %21, %9
%31 = load i64, i64* %2
ret i64 %31
}

LLVM IR (-O2):
define i64 @get_num(i8** %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
switch i8 %3, label %10 [
i8 36, label %4
i8 39, label %7
]
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %5, i8** %0
%6 = tail call i64 @get_hex(i8** %0)
br label %12
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %8, i8** %0
%9 = tail call i64 @get_ascii(i8** %0)
br label %12
10: ; preds = %1
%11 = tail call i64 @get_dec(i8** %0)
br label %12
12: ; preds = %10, %7, %4
%13 = phi i64 [ %6, %4 ], [ %9, %7 ], [ %11, %10 ]
ret i64 %13
}