#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*/ empty(int);
int eval(int);
int /*<<< orphan*/ first(int);
scalar_t__ is_f(int /*<<< orphan*/);
int rest(int);
int to_int(int number) {
  int eval_num = eval(number);
  return !is_f(empty(eval_num))
             ? 0
             : (is_f(first(eval_num)) ? 0 : 0x1) | to_int(rest(eval_num)) << 1;
}


x86 assembly (clang, -O0):
<to_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <eval@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <empty@plt>
mov    %eax,%edi
call   1030 <is_f@plt>
cmp    $0x0,%rax
jne    1199 <to_int+0x39>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    11d8 <to_int+0x78>
mov    -0x8(%rbp),%edi
call   1080 <first@plt>
mov    %eax,%edi
call   1030 <is_f@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <rest@plt>
mov    %eax,%edi
call   1060 <to_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_int>:
push   %rbp
push   %rbx
push   %rax
call   1070 <eval@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1050 <empty@plt>
mov    %eax,%edi
call   1030 <is_f@plt>
test   %rax,%rax
je     11a6 <to_int+0x46>
mov    %ebp,%edi
call   1080 <first@plt>
mov    %eax,%edi
call   1030 <is_f@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %ebp,%edi
call   1040 <rest@plt>
mov    %eax,%edi
call   1060 <to_int@plt>
lea    (%rbx,%rax,2),%eax
jmp    11a8 <to_int+0x48>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @to_int(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @eval(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @empty(i32 %6)
%8 = call i64 @is_f(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %1
br label %23
11: ; preds = %1
%12 = load i32, i32* %3
%13 = call i32 @first(i32 %12)
%14 = call i64 @is_f(i32 %13)
%15 = icmp ne i64 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 0, i32 1
%18 = load i32, i32* %3
%19 = call i32 @rest(i32 %18)
%20 = call i32 @to_int(i32 %19)
%21 = shl i32 %20, 1
%22 = or i32 %17, %21
br label %23
23: ; preds = %11, %10
%24 = phi i32 [ 0, %10 ], [ %22, %11 ]
ret i32 %24
}

LLVM IR (-O2):
define i32 @to_int(i32 %0) {
%2 = tail call i32 @eval(i32 %0)
%3 = tail call i32 @empty(i32 %2)
%4 = tail call i64 @is_f(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1, %8
%7 = phi i32 [ %16, %8 ], [ 0, %1 ]
ret i32 %7
8: ; preds = %1
%9 = tail call i32 @first(i32 %2)
%10 = tail call i64 @is_f(i32 %9)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
%13 = tail call i32 @rest(i32 %2)
%14 = tail call i32 @to_int(i32 %13)
%15 = shl i32 %14, 1
%16 = or i32 %15, %12
br label %6
}