#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 scalar_t__ int32_t;

/* Variables and functions */
scalar_t__ funge_stack_pop(int /*<<< orphan*/, scalar_t__ *);
scalar_t__ funge_stack_push(int /*<<< orphan*/, scalar_t__ *);
int /*<<< orphan*/ funge_thread_stack();
int32_t funge_add(int32_t funge_char __attribute__((unused))) {
  int32_t vala;
  int32_t valb;
  int32_t rc;
  rc = funge_stack_pop(funge_thread_stack(), &valb);
  rc = funge_stack_pop(funge_thread_stack(), &vala);
  vala = vala + valb;
  rc = funge_stack_push(funge_thread_stack(), &vala);
  return rc;
}


x86 assembly (clang, -O0):
<funge_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <funge_thread_stack@plt>
mov    %eax,%edi
lea    -0x18(%rbp),%rsi
call   1050 <funge_stack_pop@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <funge_thread_stack@plt>
mov    %eax,%edi
lea    -0x10(%rbp),%rsi
call   1050 <funge_stack_pop@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <funge_thread_stack@plt>
mov    %eax,%edi
lea    -0x10(%rbp),%rsi
call   1030 <funge_stack_push@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funge_add>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <funge_thread_stack@plt>
mov    %rsp,%rsi
mov    %eax,%edi
call   1050 <funge_stack_pop@plt>
xor    %eax,%eax
call   1040 <funge_thread_stack@plt>
lea    0x8(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <funge_stack_pop@plt>
mov    (%rsp),%rax
add    %rax,0x8(%rsp)
xor    %eax,%eax
call   1040 <funge_thread_stack@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <funge_stack_push@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @funge_add(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
%6 = call i32 (...) @funge_thread_stack()
%7 = call i64 @funge_stack_pop(i32 %6, i64* %4)
store i64 %7, i64* %5
%8 = call i32 (...) @funge_thread_stack()
%9 = call i64 @funge_stack_pop(i32 %8, i64* %3)
store i64 %9, i64* %5
%10 = load i64, i64* %3
%11 = load i64, i64* %4
%12 = add nsw i64 %10, %11
store i64 %12, i64* %3
%13 = call i32 (...) @funge_thread_stack()
%14 = call i64 @funge_stack_push(i32 %13, i64* %3)
store i64 %14, i64* %5
%15 = load i64, i64* %5
ret i64 %15
}

LLVM IR (-O2):
define i64 @funge_add(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = bitcast i64* %2 to i8*
%5 = bitcast i64* %3 to i8*
%6 = tail call i32 (...) @funge_thread_stack()
%7 = call i64 @funge_stack_pop(i32 %6, i64* %3)
%8 = call i32 (...) @funge_thread_stack()
%9 = call i64 @funge_stack_pop(i32 %8, i64* %2)
%10 = load i64, i64* %2
%11 = load i64, i64* %3
%12 = add nsw i64 %11, %10
store i64 %12, i64* %2
%13 = call i32 (...) @funge_thread_stack()
%14 = call i64 @funge_stack_push(i32 %13, i64* %2)
ret i64 %14
}