#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 */
typedef int uint8_t;
struct single_list_t {
  int dummy;
};

/* Variables and functions */
struct single_list_t *creat_list(int);
int /*<<< orphan*/ delete_list(struct single_list_t *);
int /*<<< orphan*/ delete_node(struct single_list_t **, int *, int);
int /*<<< orphan*/ insert_node(struct single_list_t **, int *, int);
int /*<<< orphan*/ print_list(struct single_list_t *);
int /*<<< orphan*/ reverse_list(struct single_list_t *, int);
int /*<<< orphan*/ set_node_val(struct single_list_t *, int, int);
int /*<<< orphan*/ sort_list(struct single_list_t *, int);
int main(int argc, char *argv[]) {
  uint8_t i, len = 100;
  struct single_list_t *root_node;
  root_node = creat_list(len);
  for (i = 0; i < len; i += 1) {
    set_node_val(root_node, i, 2 * i + 128);
  }
  insert_node(&root_node, &len, 0);
  set_node_val(root_node, 0, 99);
  insert_node(&root_node, &len, 23);
  set_node_val(root_node, 23, 77);
  insert_node(&root_node, &len, len - 1);
  set_node_val(root_node, len - 1, 55);
  delete_node(&root_node, &len, 0);
  delete_node(&root_node, &len, 24);
  delete_node(&root_node, &len, len - 1);
  sort_list(root_node, 1);
  reverse_list(root_node, len);
  print_list(root_node);
  delete_list(root_node);
  root_node = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x64,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <creat_list@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11e2 <main+0x62>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
add    $0x80,%edx
call   1080 <set_node_val@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <main+0x30>
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1060 <insert_node@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1080 <set_node_val@plt>
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x17,%edx
call   1060 <insert_node@plt>
mov    -0x20(%rbp),%rdi
mov    $0x17,%esi
mov    $0x4d,%edx
call   1080 <set_node_val@plt>
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <insert_node@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
sub    $0x1,%esi
mov    $0x37,%edx
call   1080 <set_node_val@plt>
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1050 <delete_node@plt>
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x18,%edx
call   1050 <delete_node@plt>
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <delete_node@plt>
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   10a0 <sort_list@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1070 <reverse_list@plt>
mov    -0x20(%rbp),%rdi
call   1030 <print_list@plt>
mov    -0x20(%rbp),%rdi
call   1090 <delete_list@plt>
movq   $0x0,-0x20(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x64,0x4(%rsp)
mov    $0x64,%edi
call   1040 <creat_list@plt>
mov    %rax,%r14
mov    %rax,0x8(%rsp)
xor    %ebp,%ebp
mov    $0x80,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1080 <set_node_val@plt>
add    $0x1,%ebp
add    $0x2,%ebx
cmp    $0x148,%ebx
jne    11b0 <main+0x30>
lea    0x8(%rsp),%rbx
lea    0x4(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1060 <insert_node@plt>
mov    0x8(%rsp),%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1080 <set_node_val@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x17,%edx
call   1060 <insert_node@plt>
mov    0x8(%rsp),%rdi
mov    $0x17,%esi
mov    $0x4d,%edx
call   1080 <set_node_val@plt>
mov    0x4(%rsp),%edx
add    $0xffffffff,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <insert_node@plt>
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%esi
add    $0xffffffff,%esi
mov    $0x37,%edx
call   1080 <set_node_val@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1050 <delete_node@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x18,%edx
call   1050 <delete_node@plt>
mov    0x4(%rsp),%edx
add    $0xffffffff,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <delete_node@plt>
mov    0x8(%rsp),%rdi
mov    $0x1,%esi
call   10a0 <sort_list@plt>
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%esi
call   1070 <reverse_list@plt>
mov    0x8(%rsp),%rdi
call   1030 <print_list@plt>
mov    0x8(%rsp),%rdi
call   1090 <delete_list@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.single_list_t = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.single_list_t*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %7
%9 = load i32, i32* %7
%10 = call %struct.single_list_t* @creat_list(i32 %9)
store %struct.single_list_t* %10, %struct.single_list_t** %8
store i32 0, i32* %6
br label %11
11: ; preds = %22, %2
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %25
15: ; preds = %11
%16 = load %struct.single_list_t*, %struct.single_list_t** %8
%17 = load i32, i32* %6
%18 = load i32, i32* %6
%19 = mul nsw i32 2, %18
%20 = add nsw i32 %19, 128
%21 = call i32 @set_node_val(%struct.single_list_t* %16, i32 %17, i32 %20)
br label %22
22: ; preds = %15
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
br label %11
25: ; preds = %11
%26 = call i32 @insert_node(%struct.single_list_t** %8, i32* %7, i32 0)
%27 = load %struct.single_list_t*, %struct.single_list_t** %8
%28 = call i32 @set_node_val(%struct.single_list_t* %27, i32 0, i32 99)
%29 = call i32 @insert_node(%struct.single_list_t** %8, i32* %7, i32 23)
%30 = load %struct.single_list_t*, %struct.single_list_t** %8
%31 = call i32 @set_node_val(%struct.single_list_t* %30, i32 23, i32 77)
%32 = load i32, i32* %7
%33 = sub nsw i32 %32, 1
%34 = call i32 @insert_node(%struct.single_list_t** %8, i32* %7, i32 %33)
%35 = load %struct.single_list_t*, %struct.single_list_t** %8
%36 = load i32, i32* %7
%37 = sub nsw i32 %36, 1
%38 = call i32 @set_node_val(%struct.single_list_t* %35, i32 %37, i32 55)
%39 = call i32 @delete_node(%struct.single_list_t** %8, i32* %7, i32 0)
%40 = call i32 @delete_node(%struct.single_list_t** %8, i32* %7, i32 24)
%41 = load i32, i32* %7
%42 = sub nsw i32 %41, 1
%43 = call i32 @delete_node(%struct.single_list_t** %8, i32* %7, i32 %42)
%44 = load %struct.single_list_t*, %struct.single_list_t** %8
%45 = call i32 @sort_list(%struct.single_list_t* %44, i32 1)
%46 = load %struct.single_list_t*, %struct.single_list_t** %8
%47 = load i32, i32* %7
%48 = call i32 @reverse_list(%struct.single_list_t* %46, i32 %47)
%49 = load %struct.single_list_t*, %struct.single_list_t** %8
%50 = call i32 @print_list(%struct.single_list_t* %49)
%51 = load %struct.single_list_t*, %struct.single_list_t** %8
%52 = call i32 @delete_list(%struct.single_list_t* %51)
store %struct.single_list_t* null, %struct.single_list_t** %8
ret i32 0
}

LLVM IR (-O2):
%struct.single_list_t = type { i32 }
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.single_list_t*
%5 = bitcast i32* %3 to i8*
store i32 100, i32* %3
%6 = bitcast %struct.single_list_t** %4 to i8*
%7 = tail call %struct.single_list_t* @creat_list(i32 100)
store %struct.single_list_t* %7, %struct.single_list_t** %4
br label %8
8: ; preds = %2, %8
%9 = phi i32 [ 0, %2 ], [ %13, %8 ]
%10 = shl nuw nsw i32 %9, 1
%11 = add nuw nsw i32 %10, 128
%12 = tail call i32 @set_node_val(%struct.single_list_t* %7, i32 %9, i32 %11)
%13 = add nuw nsw i32 %9, 1
%14 = icmp eq i32 %13, 100
br i1 %14, label %15, label %8
15: ; preds = %8
%16 = call i32 @insert_node(%struct.single_list_t** %4, i32* %3, i32 0)
%17 = load %struct.single_list_t*, %struct.single_list_t** %4
%18 = call i32 @set_node_val(%struct.single_list_t* %17, i32 0, i32 99)
%19 = call i32 @insert_node(%struct.single_list_t** %4, i32* %3, i32 23)
%20 = load %struct.single_list_t*, %struct.single_list_t** %4
%21 = call i32 @set_node_val(%struct.single_list_t* %20, i32 23, i32 77)
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
%24 = call i32 @insert_node(%struct.single_list_t** %4, i32* %3, i32 %23)
%25 = load %struct.single_list_t*, %struct.single_list_t** %4
%26 = load i32, i32* %3
%27 = add nsw i32 %26, -1
%28 = call i32 @set_node_val(%struct.single_list_t* %25, i32 %27, i32 55)
%29 = call i32 @delete_node(%struct.single_list_t** %4, i32* %3, i32 0)
%30 = call i32 @delete_node(%struct.single_list_t** %4, i32* %3, i32 24)
%31 = load i32, i32* %3
%32 = add nsw i32 %31, -1
%33 = call i32 @delete_node(%struct.single_list_t** %4, i32* %3, i32 %32)
%34 = load %struct.single_list_t*, %struct.single_list_t** %4
%35 = call i32 @sort_list(%struct.single_list_t* %34, i32 1)
%36 = load %struct.single_list_t*, %struct.single_list_t** %4
%37 = load i32, i32* %3
%38 = call i32 @reverse_list(%struct.single_list_t* %36, i32 %37)
%39 = load %struct.single_list_t*, %struct.single_list_t** %4
%40 = call i32 @print_list(%struct.single_list_t* %39)
%41 = load %struct.single_list_t*, %struct.single_list_t** %4
%42 = call i32 @delete_list(%struct.single_list_t* %41)
ret i32 0
}