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

/* Variables and functions */
int funge_stack_pop(int /*<<< orphan*/, int *);
int funge_stack_push(int /*<<< orphan*/, int *);
int /*<<< orphan*/ funge_thread_stack();
int32_t funge_multiply(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_multiply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <funge_thread_stack@plt>
mov    %eax,%edi
lea    -0xc(%rbp),%rsi
call   1050 <funge_stack_pop@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <funge_thread_stack@plt>
mov    %eax,%edi
lea    -0x8(%rbp),%rsi
call   1050 <funge_stack_pop@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <funge_thread_stack@plt>
mov    %eax,%edi
lea    -0x8(%rbp),%rsi
call   1030 <funge_stack_push@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funge_multiply>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <funge_thread_stack@plt>
lea    0xc(%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    0xc(%rsp),%eax
imul   0x8(%rsp),%eax
mov    %eax,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 i32 @funge_multiply(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = call i32 (...) @funge_thread_stack()
%7 = call i32 @funge_stack_pop(i32 %6, i32* %4)
store i32 %7, i32* %5
%8 = call i32 (...) @funge_thread_stack()
%9 = call i32 @funge_stack_pop(i32 %8, i32* %3)
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = mul nsw i32 %10, %11
store i32 %12, i32* %3
%13 = call i32 (...) @funge_thread_stack()
%14 = call i32 @funge_stack_push(i32 %13, i32* %3)
store i32 %14, i32* %5
%15 = load i32, i32* %5
ret i32 %15
}

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