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

/* Variables and functions */
int /*<<< orphan*/ free(struct ic_transform_ir_ret *);
int /*<<< orphan*/ puts(char *);
unsigned int ic_transform_ir_ret_destroy(struct ic_transform_ir_ret *ret,
                                         unsigned int free_ret) {
  if (!ret) {
    puts("ic_transform_ir_ret_destroy: ret was null");
    return 0;
  }
  if (free_ret) {
    free(ret);
  }
  return 1;
}


x86 assembly (clang, -O0):
<ic_transform_ir_ret_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1152 <ic_transform_ir_ret_destroy+0x32>
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    116c <ic_transform_ir_ret_destroy+0x4c>
cmpl   $0x0,-0x14(%rbp)
je     1165 <ic_transform_ir_ret_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_transform_ir_ret_destroy>:
push   %rbx
test   %rdi,%rdi
je     1136 <ic_transform_ir_ret_destroy+0x16>
mov    $0x1,%ebx
test   %esi,%esi
je     1144 <ic_transform_ir_ret_destroy+0x24>
call   1030 <free@plt>
jmp    1144 <ic_transform_ir_ret_destroy+0x24>
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ic_transform_ir_ret = type { i32 }
@.str = [42 x i8] c"ic_transform_ir_ret_destroy: ret was null\00"
define i32 @ic_transform_ir_ret_destroy(%struct.ic_transform_ir_ret* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.ic_transform_ir_ret*
%5 = alloca i32
store %struct.ic_transform_ir_ret* %0, %struct.ic_transform_ir_ret** %4
store i32 %1, i32* %5
%6 = load %struct.ic_transform_ir_ret*, %struct.ic_transform_ir_ret** %4
%7 = icmp ne %struct.ic_transform_ir_ret* %6, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 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_transform_ir_ret*, %struct.ic_transform_ir_ret** %4
%15 = call i32 @free(%struct.ic_transform_ir_ret* %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_transform_ir_ret = type { i32 }
@.str = [42 x i8] c"ic_transform_ir_ret_destroy: ret was null\00"
define i32 @ic_transform_ir_ret_destroy(%struct.ic_transform_ir_ret* %0, i32 %1) {
%3 = icmp eq %struct.ic_transform_ir_ret* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 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_transform_ir_ret* %0)
br label %10
10: ; preds = %6, %8, %4
%11 = phi i32 [ 0, %4 ], [ 1, %8 ], [ 1, %6 ]
ret i32 %11
}