#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 */
struct node *deleteNode(struct node *, int);
int /*<<< orphan*/ inorder(struct node *);
struct node *insert(struct node *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  struct node *root = NULL;
  root = insert(root, 50);
  root = insert(root, 30);
  root = insert(root, 20);
  root = insert(root, 40);
  root = insert(root, 70);
  root = insert(root, 60);
  root = insert(root, 80);
  printf("Inorder traversal of the given tree \n");
  inorder(root);
  printf("\nDelete 20\n");
  root = deleteNode(root, 20);
  inorder(root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x32,%esi
call   1050 <insert@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1e,%esi
call   1050 <insert@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x14,%esi
call   1050 <insert@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x28,%esi
call   1050 <insert@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x46,%esi
call   1050 <insert@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3c,%esi
call   1050 <insert@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x50,%esi
call   1050 <insert@plt>
mov    %rax,-0x10(%rbp)
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <inorder@plt>
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%esi
call   1060 <deleteNode@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <inorder@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
mov    $0x32,%esi
call   1050 <insert@plt>
mov    %rax,%rdi
mov    $0x1e,%esi
call   1050 <insert@plt>
mov    %rax,%rdi
mov    $0x14,%esi
call   1050 <insert@plt>
mov    %rax,%rdi
mov    $0x28,%esi
call   1050 <insert@plt>
mov    %rax,%rdi
mov    $0x46,%esi
call   1050 <insert@plt>
mov    %rax,%rdi
mov    $0x3c,%esi
call   1050 <insert@plt>
mov    %rax,%rdi
mov    $0x50,%esi
call   1050 <insert@plt>
mov    %rax,%rbx
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <inorder@plt>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1060 <deleteNode@plt>
mov    %rax,%rdi
call   1040 <inorder@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [38 x i8] c"Inorder traversal of the given tree \0A\00"
@.str.1 = [12 x i8] c"\0ADelete 20\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
store i32 0, i32* %1
store %struct.node* null, %struct.node** %2
%3 = load %struct.node*, %struct.node** %2
%4 = call %struct.node* @insert(%struct.node* %3, i32 50)
store %struct.node* %4, %struct.node** %2
%5 = load %struct.node*, %struct.node** %2
%6 = call %struct.node* @insert(%struct.node* %5, i32 30)
store %struct.node* %6, %struct.node** %2
%7 = load %struct.node*, %struct.node** %2
%8 = call %struct.node* @insert(%struct.node* %7, i32 20)
store %struct.node* %8, %struct.node** %2
%9 = load %struct.node*, %struct.node** %2
%10 = call %struct.node* @insert(%struct.node* %9, i32 40)
store %struct.node* %10, %struct.node** %2
%11 = load %struct.node*, %struct.node** %2
%12 = call %struct.node* @insert(%struct.node* %11, i32 70)
store %struct.node* %12, %struct.node** %2
%13 = load %struct.node*, %struct.node** %2
%14 = call %struct.node* @insert(%struct.node* %13, i32 60)
store %struct.node* %14, %struct.node** %2
%15 = load %struct.node*, %struct.node** %2
%16 = call %struct.node* @insert(%struct.node* %15, i32 80)
store %struct.node* %16, %struct.node** %2
%17 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%18 = load %struct.node*, %struct.node** %2
%19 = call i32 @inorder(%struct.node* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%21 = load %struct.node*, %struct.node** %2
%22 = call %struct.node* @deleteNode(%struct.node* %21, i32 20)
store %struct.node* %22, %struct.node** %2
%23 = load %struct.node*, %struct.node** %2
%24 = call i32 @inorder(%struct.node* %23)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@str = [37 x i8] c"Inorder traversal of the given tree \00"
@str.2 = [11 x i8] c"\0ADelete 20\00"
define i32 @main() {
%1 = tail call %struct.node* @insert(%struct.node* null, i32 50)
%2 = tail call %struct.node* @insert(%struct.node* %1, i32 30)
%3 = tail call %struct.node* @insert(%struct.node* %2, i32 20)
%4 = tail call %struct.node* @insert(%struct.node* %3, i32 40)
%5 = tail call %struct.node* @insert(%struct.node* %4, i32 70)
%6 = tail call %struct.node* @insert(%struct.node* %5, i32 60)
%7 = tail call %struct.node* @insert(%struct.node* %6, i32 80)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @inorder(%struct.node* %7)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.2, i64 0, i64 0))
%11 = tail call %struct.node* @deleteNode(%struct.node* %7, i32 20)
%12 = tail call i32 @inorder(%struct.node* %11)
ret i32 0
}