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

/* Variables and functions */
int /*<<< orphan*/ empty(int);
int eval(int);
int /*<<< orphan*/ first(int);
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/ *);
scalar_t__ is_f(int /*<<< orphan*/);
int rest(int);
int /*<<< orphan*/ to_int(int /*<<< orphan*/);
void output(int expr, FILE *stream) {
  int list = eval(expr);
  while (is_f(empty(list))) {
    fputc(to_int(first(list)), stream);
    list = eval(rest(list));
  };
}


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1080 <eval@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <empty@plt>
mov    %eax,%edi
call   1030 <is_f@plt>
cmp    $0x0,%rax
je     11d4 <output+0x64>
mov    -0x14(%rbp),%edi
call   1090 <first@plt>
mov    %eax,%edi
call   1070 <to_int@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1050 <fputc@plt>
mov    -0x14(%rbp),%edi
call   1040 <rest@plt>
mov    %eax,%edi
call   1080 <eval@plt>
mov    %eax,-0x14(%rbp)
jmp    118a <output+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cs nopw 0x0(%rax,%rax,1)
call   1080 <eval@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <empty@plt>
mov    %eax,%edi
call   1030 <is_f@plt>
test   %rax,%rax
je     11bd <output+0x4d>
mov    %ebp,%edi
call   1090 <first@plt>
mov    %eax,%edi
call   1070 <to_int@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    %ebp,%edi
call   1040 <rest@plt>
mov    %eax,%edi
jmp    1180 <output+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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