#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 */
struct Stack {
  int dummy;
};
struct Number {
  int dummy;
};

/* Variables and functions */
struct Number *number_get_reciprocal(struct Stack *, struct Stack *,
                                     struct Number *);
struct Number *number_multiply(struct Stack *, struct Stack *, struct Number *,
                               struct Number *);
struct Number *number_divide(struct Stack *restrict output_stack,
                             struct Stack *restrict local_stack,
                             struct Number *dividend, struct Number *divisor) {
  struct Number *reciprocal =
      number_get_reciprocal(local_stack, output_stack, divisor);
  if (!reciprocal) {
    return 0;
  }
  return number_multiply(output_stack, local_stack, dividend, reciprocal);
}


x86 assembly (clang, -O0):
<number_divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <number_get_reciprocal@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1165 <number_divide+0x45>
movq   $0x0,-0x8(%rbp)
jmp    117e <number_divide+0x5e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1040 <number_multiply@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_divide>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
mov    %rcx,%rdx
call   1030 <number_get_reciprocal@plt>
test   %rax,%rax
je     1157 <number_divide+0x37>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rax,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <number_multiply@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Stack = type { i32 }
%struct.Number = type { i32 }
define %struct.Number* @number_divide(%struct.Stack* noalias %0, %struct.Stack* noalias %1, %struct.Number* %2, %struct.Number* %3) {
%5 = alloca %struct.Number*
%6 = alloca %struct.Stack*
%7 = alloca %struct.Stack*
%8 = alloca %struct.Number*
%9 = alloca %struct.Number*
%10 = alloca %struct.Number*
store %struct.Stack* %0, %struct.Stack** %6
store %struct.Stack* %1, %struct.Stack** %7
store %struct.Number* %2, %struct.Number** %8
store %struct.Number* %3, %struct.Number** %9
%11 = load %struct.Stack*, %struct.Stack** %7
%12 = load %struct.Stack*, %struct.Stack** %6
%13 = load %struct.Number*, %struct.Number** %9
%14 = call %struct.Number* @number_get_reciprocal(%struct.Stack* %11, %struct.Stack* %12, %struct.Number* %13)
store %struct.Number* %14, %struct.Number** %10
%15 = load %struct.Number*, %struct.Number** %10
%16 = icmp ne %struct.Number* %15, null
br i1 %16, label %18, label %17
17: ; preds = %4
store %struct.Number* null, %struct.Number** %5
br label %24
18: ; preds = %4
%19 = load %struct.Stack*, %struct.Stack** %6
%20 = load %struct.Stack*, %struct.Stack** %7
%21 = load %struct.Number*, %struct.Number** %8
%22 = load %struct.Number*, %struct.Number** %10
%23 = call %struct.Number* @number_multiply(%struct.Stack* %19, %struct.Stack* %20, %struct.Number* %21, %struct.Number* %22)
store %struct.Number* %23, %struct.Number** %5
br label %24
24: ; preds = %18, %17
%25 = load %struct.Number*, %struct.Number** %5
ret %struct.Number* %25
}

LLVM IR (-O2):
%struct.Stack = type { i32 }
%struct.Number = type { i32 }
define %struct.Number* @number_divide(%struct.Stack* noalias %0, %struct.Stack* noalias %1, %struct.Number* %2, %struct.Number* %3) {
%5 = tail call %struct.Number* @number_get_reciprocal(%struct.Stack* %1, %struct.Stack* %0, %struct.Number* %3)
%6 = icmp eq %struct.Number* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call %struct.Number* @number_multiply(%struct.Stack* %0, %struct.Stack* %1, %struct.Number* %2, %struct.Number* %5)
br label %9
9: ; preds = %4, %7
%10 = phi %struct.Number* [ %8, %7 ], [ null, %4 ]
ret %struct.Number* %10
}