#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*/ Rf_error(char *);
long strtol(char const *, char **, int);
long trio_to_long(const char *string, char **endp, int base) {
  if (!(string))
    Rf_error("internal error in trio library");
  if (!((base >= 2) && (base <= 36)))
    Rf_error("internal error in trio library");
  return strtol(string, endp, base);
}


x86 assembly (clang, -O0):
<trio_to_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114a <trio_to_long+0x2a>
lea    0xebb(%rip),%rdi
call   1030 <Rf_error@plt>
cmpl   $0x2,-0x14(%rbp)
jl     115e <trio_to_long+0x3e>
cmpl   $0x24,-0x14(%rbp)
jle    116a <trio_to_long+0x4a>
lea    0xe9b(%rip),%rdi
call   1030 <Rf_error@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <strtol@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trio_to_long>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
jne    113f <trio_to_long+0x1f>
lea    0xec6(%rip),%rdi
call   1030 <Rf_error@plt>
lea    -0x2(%r15),%eax
cmp    $0x23,%eax
jb     1154 <trio_to_long+0x34>
lea    0xeb1(%rip),%rdi
call   1030 <Rf_error@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strtol@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"internal error in trio library\00"
define i64 @trio_to_long(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = call i32 @Rf_error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %3
%12 = load i32, i32* %6
%13 = icmp sge i32 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %6
%16 = icmp sle i32 %15, 36
br i1 %16, label %19, label %17
17: ; preds = %14, %11
%18 = call i32 @Rf_error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = load i8*, i8** %4
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = call i64 @strtol(i8* %20, i8** %21, i32 %22)
ret i64 %23
}

LLVM IR (-O2):
@.str = [31 x i8] c"internal error in trio library\00"
define i64 @trio_to_long(i8* %0, i8** nocapture %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @Rf_error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
%8 = add i32 %2, -2
%9 = icmp ult i32 %8, 35
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @Rf_error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %7, %10
%13 = tail call i64 @strtol(i8* %0, i8** %1, i32 %2)
ret i64 %13
}