#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 sNode {
  int dummy;
};

/* Variables and functions */
scalar_t__ isEmpty(struct sNode *);
int pop(struct sNode **);
int /*<<< orphan*/ push(struct sNode **, int);
void insertAtBottom(struct sNode **top_ref, int item) {
  if (isEmpty(*top_ref))
    push(top_ref, item);
  else {
    int temp = pop(top_ref);
    insertAtBottom(top_ref, item);
    push(top_ref, temp);
  }
}


x86 assembly (clang, -O0):
<insertAtBottom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1050 <isEmpty@plt>
cmp    $0x0,%rax
je     1176 <insertAtBottom+0x36>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <push@plt>
jmp    119a <insertAtBottom+0x5a>
mov    -0x8(%rbp),%rdi
call   1030 <pop@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <insertAtBottom@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1060 <push@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertAtBottom>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1050 <isEmpty@plt>
test   %rax,%rax
jne    116e <insertAtBottom+0x2e>
mov    %rbx,%rdi
call   1030 <pop@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <insertAtBottom@plt>
mov    %r14d,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <push@plt>

LLVM IR (-O0):
%struct.sNode = type { i32 }
define void @insertAtBottom(%struct.sNode** %0, i32 %1) {
%3 = alloca %struct.sNode**
%4 = alloca i32
%5 = alloca i32
store %struct.sNode** %0, %struct.sNode*** %3
store i32 %1, i32* %4
%6 = load %struct.sNode**, %struct.sNode*** %3
%7 = load %struct.sNode*, %struct.sNode** %6
%8 = call i64 @isEmpty(%struct.sNode* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load %struct.sNode**, %struct.sNode*** %3
%12 = load i32, i32* %4
%13 = call i32 @push(%struct.sNode** %11, i32 %12)
br label %22
14: ; preds = %2
%15 = load %struct.sNode**, %struct.sNode*** %3
%16 = call i32 @pop(%struct.sNode** %15)
store i32 %16, i32* %5
%17 = load %struct.sNode**, %struct.sNode*** %3
%18 = load i32, i32* %4
%19 = load %struct.sNode**, %struct.sNode*** %3
%20 = load i32, i32* %5
%21 = call i32 @push(%struct.sNode** %19, i32 %20)
br label %22
22: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
%struct.sNode = type { i32 }
define void @insertAtBottom(%struct.sNode** %0, i32 %1) {
%3 = load %struct.sNode*, %struct.sNode** %0
%4 = tail call i64 @isEmpty(%struct.sNode* %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2, %9
%7 = phi i32 [ %10, %9 ], [ %1, %2 ]
%8 = tail call i32 @push(%struct.sNode** %0, i32 %7)
ret void
9: ; preds = %2
%10 = tail call i32 @pop(%struct.sNode** %0)
tail call void @insertAtBottom(%struct.sNode** %0, i32 %1)
br label %6
}