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

/* Variables and functions */
int /*<<< orphan*/ free(struct ic_backend_pancake_value_stack *);
int /*<<< orphan*/ puts(char *);
unsigned int ic_backend_pancake_value_stack_destroy(
    struct ic_backend_pancake_value_stack *stack, unsigned int free_stack) {
  if (!stack) {
    puts("ic_backend_pancake_value_stack_destroy: stack was null");
    return 0;
  }
  if (free_stack) {
    free(stack);
  }
  return 1;
}


x86 assembly (clang, -O0):
<ic_backend_pancake_value_stack_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1152 <ic_backend_pancake_value_stack_destroy+0x32>
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    116c <ic_backend_pancake_value_stack_destroy+0x4c>
cmpl   $0x0,-0x14(%rbp)
je     1165 <ic_backend_pancake_value_stack_destroy+0x45>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_backend_pancake_value_stack_destroy>:
push   %rbx
test   %rdi,%rdi
je     1136 <ic_backend_pancake_value_stack_destroy+0x16>
mov    $0x1,%ebx
test   %esi,%esi
je     1144 <ic_backend_pancake_value_stack_destroy+0x24>
call   1030 <free@plt>
jmp    1144 <ic_backend_pancake_value_stack_destroy+0x24>
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ic_backend_pancake_value_stack = type { i32 }
@.str = [55 x i8] c"ic_backend_pancake_value_stack_destroy: stack was null\00"
define i32 @ic_backend_pancake_value_stack_destroy(%struct.ic_backend_pancake_value_stack* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.ic_backend_pancake_value_stack*
%5 = alloca i32
store %struct.ic_backend_pancake_value_stack* %0, %struct.ic_backend_pancake_value_stack** %4
store i32 %1, i32* %5
%6 = load %struct.ic_backend_pancake_value_stack*, %struct.ic_backend_pancake_value_stack** %4
%7 = icmp ne %struct.ic_backend_pancake_value_stack* %6, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @puts(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %17
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load %struct.ic_backend_pancake_value_stack*, %struct.ic_backend_pancake_value_stack** %4
%15 = call i32 @free(%struct.ic_backend_pancake_value_stack* %14)
br label %16
16: ; preds = %13, %10
store i32 1, i32* %3
br label %17
17: ; preds = %16, %8
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
%struct.ic_backend_pancake_value_stack = type { i32 }
@.str = [55 x i8] c"ic_backend_pancake_value_stack_destroy: stack was null\00"
define i32 @ic_backend_pancake_value_stack_destroy(%struct.ic_backend_pancake_value_stack* %0, i32 %1) {
%3 = icmp eq %struct.ic_backend_pancake_value_stack* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = icmp eq i32 %1, 0
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @free(%struct.ic_backend_pancake_value_stack* %0)
br label %10
10: ; preds = %6, %8, %4
%11 = phi i32 [ 0, %4 ], [ 1, %8 ], [ 1, %6 ]
ret i32 %11
}