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

/* Variables and functions */
int /*<<< orphan*/ abort();
struct node *create_tree();
struct node *tree_add(struct node *);
struct node *tree_get_parent(struct node *);
int main0() {
  struct node *node = create_tree();
  node = tree_add(node);
  node = tree_add(node);
  node = tree_get_parent(node);
  if (node == 0)
    abort();
  node = tree_add(node);
  node = tree_get_parent(node);
  if (node == 0)
    abort();
  node = tree_get_parent(node);
  if (node == 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <create_tree@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <tree_add@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <tree_add@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    118c <main0+0x4c>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1060 <tree_add@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11b8 <main0+0x78>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1050 <tree_get_parent@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11d7 <main0+0x97>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main0>:
push   %rax
xor    %eax,%eax
call   1040 <create_tree@plt>
mov    %rax,%rdi
call   1060 <tree_add@plt>
mov    %rax,%rdi
call   1060 <tree_add@plt>
mov    %rax,%rdi
call   1050 <tree_get_parent@plt>
test   %rax,%rax
je     118b <main0+0x4b>
mov    %rax,%rdi
call   1060 <tree_add@plt>
mov    %rax,%rdi
call   1050 <tree_get_parent@plt>
test   %rax,%rax
je     118b <main0+0x4b>
mov    %rax,%rdi
call   1050 <tree_get_parent@plt>
test   %rax,%rax
je     118b <main0+0x4b>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
define i32 @main0() {
%1 = alloca %struct.node*
%2 = call %struct.node* (...) @create_tree()
store %struct.node* %2, %struct.node** %1
%3 = load %struct.node*, %struct.node** %1
%4 = call %struct.node* @tree_add(%struct.node* %3)
store %struct.node* %4, %struct.node** %1
%5 = load %struct.node*, %struct.node** %1
%6 = call %struct.node* @tree_add(%struct.node* %5)
store %struct.node* %6, %struct.node** %1
%7 = load %struct.node*, %struct.node** %1
%8 = call %struct.node* @tree_get_parent(%struct.node* %7)
store %struct.node* %8, %struct.node** %1
%9 = load %struct.node*, %struct.node** %1
%10 = icmp eq %struct.node* %9, null
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %0
%14 = load %struct.node*, %struct.node** %1
%15 = call %struct.node* @tree_add(%struct.node* %14)
store %struct.node* %15, %struct.node** %1
%16 = load %struct.node*, %struct.node** %1
%17 = call %struct.node* @tree_get_parent(%struct.node* %16)
store %struct.node* %17, %struct.node** %1
%18 = load %struct.node*, %struct.node** %1
%19 = icmp eq %struct.node* %18, null
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %13
%23 = load %struct.node*, %struct.node** %1
%24 = call %struct.node* @tree_get_parent(%struct.node* %23)
store %struct.node* %24, %struct.node** %1
%25 = load %struct.node*, %struct.node** %1
%26 = icmp eq %struct.node* %25, null
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main0() {
%1 = tail call %struct.node* (...) @create_tree()
%2 = tail call %struct.node* @tree_add(%struct.node* %1)
%3 = tail call %struct.node* @tree_add(%struct.node* %2)
%4 = tail call %struct.node* @tree_get_parent(%struct.node* %3)
%5 = icmp eq %struct.node* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = tail call %struct.node* @tree_add(%struct.node* %4)
%10 = tail call %struct.node* @tree_get_parent(%struct.node* %9)
%11 = icmp eq %struct.node* %10, null
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 (...) @abort()
unreachable
14: ; preds = %8
%15 = tail call %struct.node* @tree_get_parent(%struct.node* %10)
%16 = icmp eq %struct.node* %15, null
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 (...) @abort()
unreachable
19: ; preds = %14
ret i32 0
}