#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*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ strtoll(char const *, int /*<<< orphan*/ *, int);
int64_t mlt_property_atoll(const char *value) {
  if (value == NULL)
    return 0;
  else if (value[0] == '0' && value[1] == 'x')
    return strtoll(value + 2, NULL, 16);
  else
    return strtoll(value, NULL, 10);
}


x86 assembly (clang, -O0):
<mlt_property_atoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <mlt_property_atoll+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1187 <mlt_property_atoll+0x77>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    1172 <mlt_property_atoll+0x62>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    1172 <mlt_property_atoll+0x62>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1030 <strtoll@plt>
mov    %eax,-0x4(%rbp)
jmp    1187 <mlt_property_atoll+0x77>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlt_property_atoll>:
test   %rdi,%rdi
je     113c <mlt_property_atoll+0x2c>
cmpb   $0x30,(%rdi)
jne    1130 <mlt_property_atoll+0x20>
cmpb   $0x78,0x1(%rdi)
jne    1130 <mlt_property_atoll+0x20>
add    $0x2,%rdi
xor    %esi,%esi
mov    $0x10,%edx
jmp    1030 <strtoll@plt>
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <strtoll@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @mlt_property_atoll(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
%9 = icmp eq i8 %8, 120
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = tail call i32 @strtoll(i8* nocapture %11, i32* null, i32 16)
br label %15
13: ; preds = %6, %3
%14 = tail call i32 @strtoll(i8* nocapture %0, i32* null, i32 10)
br label %15
15: ; preds = %1, %13, %10
%16 = phi i32 [ %12, %10 ], [ %14, %13 ], [ 0, %1 ]
ret i32 %16
}