#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*/ add_node_end(int, struct node *);
int /*<<< orphan*/ add_node_start(int, struct node *);
struct node *create_node(int /*<<< orphan*/);
int /*<<< orphan*/ delete_node(int, struct node *);
int /*<<< orphan*/ display_list(struct node *);
int /*<<< orphan*/ printf(char *, int);
int search(int, struct node *);
int main() {
  struct node *HEAD = create_node(0);
  add_node_start(4, HEAD);
  add_node_start(6, HEAD);
  add_node_start(1, HEAD);
  display_list(HEAD);
  printf("\nposition of 4 is : %d \n", search(4, HEAD));
  delete_node(4, HEAD);
  add_node_end(77, HEAD);
  add_node_end(88, HEAD);
  add_node_end(99, HEAD);
  display_list(HEAD);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1090 <create_node@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4,%edi
call   1030 <add_node_start@plt>
mov    -0x10(%rbp),%rsi
mov    $0x6,%edi
call   1030 <add_node_start@plt>
mov    -0x10(%rbp),%rsi
mov    $0x1,%edi
call   1030 <add_node_start@plt>
mov    -0x10(%rbp),%rdi
call   1080 <display_list@plt>
mov    -0x10(%rbp),%rsi
mov    $0x4,%edi
call   1060 <search@plt>
mov    %eax,%esi
lea    0xe2c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    $0x4,%edi
call   1070 <delete_node@plt>
mov    -0x10(%rbp),%rsi
mov    $0x4d,%edi
call   1040 <add_node_end@plt>
mov    -0x10(%rbp),%rsi
mov    $0x58,%edi
call   1040 <add_node_end@plt>
mov    -0x10(%rbp),%rsi
mov    $0x63,%edi
call   1040 <add_node_end@plt>
mov    -0x10(%rbp),%rdi
call   1080 <display_list@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1090 <create_node@plt>
mov    %rax,%rbx
mov    $0x4,%edi
mov    %rax,%rsi
call   1030 <add_node_start@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1030 <add_node_start@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <add_node_start@plt>
mov    %rbx,%rdi
call   1080 <display_list@plt>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1060 <search@plt>
lea    0xe42(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1070 <delete_node@plt>
mov    $0x4d,%edi
mov    %rbx,%rsi
call   1040 <add_node_end@plt>
mov    $0x58,%edi
mov    %rbx,%rsi
call   1040 <add_node_end@plt>
mov    $0x63,%edi
mov    %rbx,%rsi
call   1040 <add_node_end@plt>
mov    %rbx,%rdi
call   1080 <display_list@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [25 x i8] c"\0Aposition of 4 is : %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
store i32 0, i32* %1
%3 = call %struct.node* @create_node(i32 0)
store %struct.node* %3, %struct.node** %2
%4 = load %struct.node*, %struct.node** %2
%5 = call i32 @add_node_start(i32 4, %struct.node* %4)
%6 = load %struct.node*, %struct.node** %2
%7 = call i32 @add_node_start(i32 6, %struct.node* %6)
%8 = load %struct.node*, %struct.node** %2
%9 = call i32 @add_node_start(i32 1, %struct.node* %8)
%10 = load %struct.node*, %struct.node** %2
%11 = call i32 @display_list(%struct.node* %10)
%12 = load %struct.node*, %struct.node** %2
%13 = call i32 @search(i32 4, %struct.node* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load %struct.node*, %struct.node** %2
%16 = call i32 @delete_node(i32 4, %struct.node* %15)
%17 = load %struct.node*, %struct.node** %2
%18 = call i32 @add_node_end(i32 77, %struct.node* %17)
%19 = load %struct.node*, %struct.node** %2
%20 = call i32 @add_node_end(i32 88, %struct.node* %19)
%21 = load %struct.node*, %struct.node** %2
%22 = call i32 @add_node_end(i32 99, %struct.node* %21)
%23 = load %struct.node*, %struct.node** %2
%24 = call i32 @display_list(%struct.node* %23)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [25 x i8] c"\0Aposition of 4 is : %d \0A\00"
define i32 @main() {
%1 = tail call %struct.node* @create_node(i32 0)
%2 = tail call i32 @add_node_start(i32 4, %struct.node* %1)
%3 = tail call i32 @add_node_start(i32 6, %struct.node* %1)
%4 = tail call i32 @add_node_start(i32 1, %struct.node* %1)
%5 = tail call i32 @display_list(%struct.node* %1)
%6 = tail call i32 @search(i32 4, %struct.node* %1)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 @delete_node(i32 4, %struct.node* %1)
%9 = tail call i32 @add_node_end(i32 77, %struct.node* %1)
%10 = tail call i32 @add_node_end(i32 88, %struct.node* %1)
%11 = tail call i32 @add_node_end(i32 99, %struct.node* %1)
%12 = tail call i32 @display_list(%struct.node* %1)
ret i32 0
}