#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 addBackwardOrder(struct node *, struct node *);
int addForwardOrder(struct node *, struct node *);
int /*<<< orphan*/ addNewNode(struct node *, int);
int /*<<< orphan*/ deleteList(struct node *);
struct node *initNode(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  struct node *oneForward = initNode(6);
  addNewNode(oneForward, 1);
  addNewNode(oneForward, 7);
  struct node *twoForward = initNode(2);
  addNewNode(twoForward, 9);
  addNewNode(twoForward, 5);
  struct node *oneBackward = initNode(7);
  addNewNode(oneBackward, 1);
  addNewNode(oneBackward, 6);
  struct node *twoBackward = initNode(5);
  addNewNode(twoBackward, 9);
  addNewNode(twoBackward, 2);
  printf("Forward add:  %i\n", addForwardOrder(oneForward, twoForward));
  printf("Backward add: %i\n", addBackwardOrder(oneBackward, twoBackward));
  deleteList(oneForward);
  deleteList(twoForward);
  deleteList(oneBackward);
  deleteList(twoBackward);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x6,%edi
call   1030 <initNode@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1040 <addNewNode@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
call   1040 <addNewNode@plt>
mov    $0x2,%edi
call   1030 <initNode@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x9,%esi
call   1040 <addNewNode@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1040 <addNewNode@plt>
mov    $0x7,%edi
call   1030 <initNode@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1040 <addNewNode@plt>
mov    -0x18(%rbp),%rdi
mov    $0x6,%esi
call   1040 <addNewNode@plt>
mov    $0x5,%edi
call   1030 <initNode@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x9,%esi
call   1040 <addNewNode@plt>
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1040 <addNewNode@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <addForwardOrder@plt>
mov    %eax,%esi
lea    0xdda(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <addBackwardOrder@plt>
mov    %eax,%esi
lea    0xdd1(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <deleteList@plt>
mov    -0x10(%rbp),%rdi
call   1060 <deleteList@plt>
mov    -0x18(%rbp),%rdi
call   1060 <deleteList@plt>
mov    -0x20(%rbp),%rdi
call   1060 <deleteList@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x6,%edi
call   1030 <initNode@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <addNewNode@plt>
mov    %r14,%rdi
mov    $0x7,%esi
call   1040 <addNewNode@plt>
mov    $0x2,%edi
call   1030 <initNode@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0x9,%esi
call   1040 <addNewNode@plt>
mov    %r15,%rdi
mov    $0x5,%esi
call   1040 <addNewNode@plt>
mov    $0x7,%edi
call   1030 <initNode@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <addNewNode@plt>
mov    %r12,%rdi
mov    $0x6,%esi
call   1040 <addNewNode@plt>
mov    $0x5,%edi
call   1030 <initNode@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x9,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <addNewNode@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <addForwardOrder@plt>
lea    0xdea(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <addBackwardOrder@plt>
lea    0xde3(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1060 <deleteList@plt>
mov    %r15,%rdi
call   1060 <deleteList@plt>
mov    %r12,%rdi
call   1060 <deleteList@plt>
mov    %rbx,%rdi
call   1060 <deleteList@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [18 x i8] c"Forward add: %i\0A\00"
@.str.1 = [18 x i8] c"Backward add: %i\0A\00"
define i32 @main() {
%1 = alloca %struct.node*
%2 = alloca %struct.node*
%3 = alloca %struct.node*
%4 = alloca %struct.node*
%5 = call %struct.node* @initNode(i32 6)
store %struct.node* %5, %struct.node** %1
%6 = load %struct.node*, %struct.node** %1
%7 = call i32 @addNewNode(%struct.node* %6, i32 1)
%8 = load %struct.node*, %struct.node** %1
%9 = call i32 @addNewNode(%struct.node* %8, i32 7)
%10 = call %struct.node* @initNode(i32 2)
store %struct.node* %10, %struct.node** %2
%11 = load %struct.node*, %struct.node** %2
%12 = call i32 @addNewNode(%struct.node* %11, i32 9)
%13 = load %struct.node*, %struct.node** %2
%14 = call i32 @addNewNode(%struct.node* %13, i32 5)
%15 = call %struct.node* @initNode(i32 7)
store %struct.node* %15, %struct.node** %3
%16 = load %struct.node*, %struct.node** %3
%17 = call i32 @addNewNode(%struct.node* %16, i32 1)
%18 = load %struct.node*, %struct.node** %3
%19 = call i32 @addNewNode(%struct.node* %18, i32 6)
%20 = call %struct.node* @initNode(i32 5)
store %struct.node* %20, %struct.node** %4
%21 = load %struct.node*, %struct.node** %4
%22 = call i32 @addNewNode(%struct.node* %21, i32 9)
%23 = load %struct.node*, %struct.node** %4
%24 = call i32 @addNewNode(%struct.node* %23, i32 2)
%25 = load %struct.node*, %struct.node** %1
%26 = load %struct.node*, %struct.node** %2
%27 = call i32 @addForwardOrder(%struct.node* %25, %struct.node* %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load %struct.node*, %struct.node** %3
%30 = load %struct.node*, %struct.node** %4
%31 = call i32 @addBackwardOrder(%struct.node* %29, %struct.node* %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load %struct.node*, %struct.node** %1
%34 = call i32 @deleteList(%struct.node* %33)
%35 = load %struct.node*, %struct.node** %2
%36 = call i32 @deleteList(%struct.node* %35)
%37 = load %struct.node*, %struct.node** %3
%38 = call i32 @deleteList(%struct.node* %37)
%39 = load %struct.node*, %struct.node** %4
%40 = call i32 @deleteList(%struct.node* %39)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [18 x i8] c"Forward add: %i\0A\00"
@.str.1 = [18 x i8] c"Backward add: %i\0A\00"
define i32 @main() {
%1 = tail call %struct.node* @initNode(i32 6)
%2 = tail call i32 @addNewNode(%struct.node* %1, i32 1)
%3 = tail call i32 @addNewNode(%struct.node* %1, i32 7)
%4 = tail call %struct.node* @initNode(i32 2)
%5 = tail call i32 @addNewNode(%struct.node* %4, i32 9)
%6 = tail call i32 @addNewNode(%struct.node* %4, i32 5)
%7 = tail call %struct.node* @initNode(i32 7)
%8 = tail call i32 @addNewNode(%struct.node* %7, i32 1)
%9 = tail call i32 @addNewNode(%struct.node* %7, i32 6)
%10 = tail call %struct.node* @initNode(i32 5)
%11 = tail call i32 @addNewNode(%struct.node* %10, i32 9)
%12 = tail call i32 @addNewNode(%struct.node* %10, i32 2)
%13 = tail call i32 @addForwardOrder(%struct.node* %1, %struct.node* %4)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = tail call i32 @addBackwardOrder(%struct.node* %7, %struct.node* %10)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = tail call i32 @deleteList(%struct.node* %1)
%18 = tail call i32 @deleteList(%struct.node* %4)
%19 = tail call i32 @deleteList(%struct.node* %7)
%20 = tail call i32 @deleteList(%struct.node* %10)
ret i32 0
}