#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 circular(struct node *);
struct node *circular_list_init();
int is_circular(struct node *);
int /*<<< orphan*/ list_add_node(struct node *, int);
int /*<<< orphan*/ list_add_nodes(struct node *, int);
struct node *list_delete_nodes(struct node *, int);
int /*<<< orphan*/ list_free(struct node *);
struct node *list_init();
int /*<<< orphan*/ list_output(struct node *);
struct node *list_reverse(struct node *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  struct node *list_head;
  struct node *circular_list_head;
  list_head = list_init();
  list_output(list_head);
  list_head = list_reverse(list_head);
  list_output(list_head);
  list_add_node(list_head, 1);
  list_add_node(list_head, 2);
  list_add_nodes(list_head, 3);
  list_add_node(list_head, 2);
  list_add_node(list_head, 2);
  list_output(list_head);
  printf("is_circular: %i\n", is_circular(list_head));
  list_head = list_reverse(list_head);
  list_output(list_head);
  list_head = list_delete_nodes(list_head, 2);
  list_output(list_head);
  list_free(list_head);
  puts("------------------------------------");
  circular_list_head = circular_list_init();
  list_add_node(circular_list_head, 1);
  list_add_node(circular_list_head, 2);
  list_add_nodes(circular_list_head, 3);
  list_add_node(circular_list_head, 2);
  list_add_node(circular_list_head, 2);
  printf("is_circular: %i\n", is_circular(circular_list_head));
  printf("   circular: %i\n", circular(circular_list_head));
  list_output(circular_list_head);
  circular_list_head = list_reverse(circular_list_head);
  printf("is_circular: %i\n", is_circular(circular_list_head));
  printf("   circular: %i\n", circular(circular_list_head));
  list_output(circular_list_head);
  circular_list_head = list_delete_nodes(circular_list_head, 2);
  list_output(circular_list_head);
  list_free(circular_list_head);
  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)
mov    $0x0,%al
call   1050 <list_init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <list_output@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <list_reverse@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <list_output@plt>
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1060 <list_add_node@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    -0x18(%rbp),%rdi
mov    $0x3,%esi
call   10b0 <list_add_nodes@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <list_output@plt>
mov    -0x18(%rbp),%rdi
call   1080 <is_circular@plt>
mov    %eax,%esi
lea    0xd9f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <list_reverse@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <list_output@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1090 <list_delete_nodes@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <list_output@plt>
mov    -0x18(%rbp),%rdi
call   1070 <list_free@plt>
lea    0xd6a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   10d0 <circular_list_init@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   1060 <list_add_node@plt>
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   10b0 <list_add_nodes@plt>
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    -0x20(%rbp),%rdi
call   1080 <is_circular@plt>
mov    %eax,%esi
lea    0xcf1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   10e0 <circular@plt>
mov    %eax,%esi
lea    0xd10(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <list_output@plt>
mov    -0x20(%rbp),%rdi
call   10a0 <list_reverse@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1080 <is_circular@plt>
mov    %eax,%esi
lea    0xcad(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   10e0 <circular@plt>
mov    %eax,%esi
lea    0xccc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <list_output@plt>
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1090 <list_delete_nodes@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   10c0 <list_output@plt>
mov    -0x20(%rbp),%rdi
call   1070 <list_free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <list_init@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10c0 <list_output@plt>
mov    %rbx,%rdi
call   10a0 <list_reverse@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10c0 <list_output@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <list_add_node@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   10b0 <list_add_nodes@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    %rbx,%rdi
call   10c0 <list_output@plt>
mov    %rbx,%rdi
call   1080 <is_circular@plt>
lea    0xdbe(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   10a0 <list_reverse@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10c0 <list_output@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1090 <list_delete_nodes@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10c0 <list_output@plt>
mov    %rbx,%rdi
call   1070 <list_free@plt>
lea    0xd8b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10d0 <circular_list_init@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1,%esi
call   1060 <list_add_node@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   10b0 <list_add_nodes@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <list_add_node@plt>
mov    %rbx,%rdi
call   1080 <is_circular@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   10e0 <circular@plt>
lea    0xd3f(%rip),%r15
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   10c0 <list_output@plt>
mov    %rbx,%rdi
call   10a0 <list_reverse@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <is_circular@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   10e0 <circular@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   10c0 <list_output@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1090 <list_delete_nodes@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10c0 <list_output@plt>
mov    %rbx,%rdi
call   1070 <list_free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [17 x i8] c"is_circular: %i\0A\00"
@.str.1 = [37 x i8] c"------------------------------------\00"
@.str.2 = [17 x i8] c" circular: %i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.node*
%7 = alloca %struct.node*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call %struct.node* (...) @list_init()
store %struct.node* %8, %struct.node** %6
%9 = load %struct.node*, %struct.node** %6
%10 = call i32 @list_output(%struct.node* %9)
%11 = load %struct.node*, %struct.node** %6
%12 = call %struct.node* @list_reverse(%struct.node* %11)
store %struct.node* %12, %struct.node** %6
%13 = load %struct.node*, %struct.node** %6
%14 = call i32 @list_output(%struct.node* %13)
%15 = load %struct.node*, %struct.node** %6
%16 = call i32 @list_add_node(%struct.node* %15, i32 1)
%17 = load %struct.node*, %struct.node** %6
%18 = call i32 @list_add_node(%struct.node* %17, i32 2)
%19 = load %struct.node*, %struct.node** %6
%20 = call i32 @list_add_nodes(%struct.node* %19, i32 3)
%21 = load %struct.node*, %struct.node** %6
%22 = call i32 @list_add_node(%struct.node* %21, i32 2)
%23 = load %struct.node*, %struct.node** %6
%24 = call i32 @list_add_node(%struct.node* %23, i32 2)
%25 = load %struct.node*, %struct.node** %6
%26 = call i32 @list_output(%struct.node* %25)
%27 = load %struct.node*, %struct.node** %6
%28 = call i32 @is_circular(%struct.node* %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load %struct.node*, %struct.node** %6
%31 = call %struct.node* @list_reverse(%struct.node* %30)
store %struct.node* %31, %struct.node** %6
%32 = load %struct.node*, %struct.node** %6
%33 = call i32 @list_output(%struct.node* %32)
%34 = load %struct.node*, %struct.node** %6
%35 = call %struct.node* @list_delete_nodes(%struct.node* %34, i32 2)
store %struct.node* %35, %struct.node** %6
%36 = load %struct.node*, %struct.node** %6
%37 = call i32 @list_output(%struct.node* %36)
%38 = load %struct.node*, %struct.node** %6
%39 = call i32 @list_free(%struct.node* %38)
%40 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%41 = call %struct.node* (...) @circular_list_init()
store %struct.node* %41, %struct.node** %7
%42 = load %struct.node*, %struct.node** %7
%43 = call i32 @list_add_node(%struct.node* %42, i32 1)
%44 = load %struct.node*, %struct.node** %7
%45 = call i32 @list_add_node(%struct.node* %44, i32 2)
%46 = load %struct.node*, %struct.node** %7
%47 = call i32 @list_add_nodes(%struct.node* %46, i32 3)
%48 = load %struct.node*, %struct.node** %7
%49 = call i32 @list_add_node(%struct.node* %48, i32 2)
%50 = load %struct.node*, %struct.node** %7
%51 = call i32 @list_add_node(%struct.node* %50, i32 2)
%52 = load %struct.node*, %struct.node** %7
%53 = call i32 @is_circular(%struct.node* %52)
%54 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %53)
%55 = load %struct.node*, %struct.node** %7
%56 = call i32 @circular(%struct.node* %55)
%57 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %56)
%58 = load %struct.node*, %struct.node** %7
%59 = call i32 @list_output(%struct.node* %58)
%60 = load %struct.node*, %struct.node** %7
%61 = call %struct.node* @list_reverse(%struct.node* %60)
store %struct.node* %61, %struct.node** %7
%62 = load %struct.node*, %struct.node** %7
%63 = call i32 @is_circular(%struct.node* %62)
%64 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %63)
%65 = load %struct.node*, %struct.node** %7
%66 = call i32 @circular(%struct.node* %65)
%67 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %66)
%68 = load %struct.node*, %struct.node** %7
%69 = call i32 @list_output(%struct.node* %68)
%70 = load %struct.node*, %struct.node** %7
%71 = call %struct.node* @list_delete_nodes(%struct.node* %70, i32 2)
store %struct.node* %71, %struct.node** %7
%72 = load %struct.node*, %struct.node** %7
%73 = call i32 @list_output(%struct.node* %72)
%74 = load %struct.node*, %struct.node** %7
%75 = call i32 @list_free(%struct.node* %74)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [17 x i8] c"is_circular: %i\0A\00"
@.str.1 = [37 x i8] c"------------------------------------\00"
@.str.2 = [17 x i8] c" circular: %i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.node* (...) @list_init()
%4 = tail call i32 @list_output(%struct.node* %3)
%5 = tail call %struct.node* @list_reverse(%struct.node* %3)
%6 = tail call i32 @list_output(%struct.node* %5)
%7 = tail call i32 @list_add_node(%struct.node* %5, i32 1)
%8 = tail call i32 @list_add_node(%struct.node* %5, i32 2)
%9 = tail call i32 @list_add_nodes(%struct.node* %5, i32 3)
%10 = tail call i32 @list_add_node(%struct.node* %5, i32 2)
%11 = tail call i32 @list_add_node(%struct.node* %5, i32 2)
%12 = tail call i32 @list_output(%struct.node* %5)
%13 = tail call i32 @is_circular(%struct.node* %5)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = tail call %struct.node* @list_reverse(%struct.node* %5)
%16 = tail call i32 @list_output(%struct.node* %15)
%17 = tail call %struct.node* @list_delete_nodes(%struct.node* %15, i32 2)
%18 = tail call i32 @list_output(%struct.node* %17)
%19 = tail call i32 @list_free(%struct.node* %17)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call %struct.node* (...) @circular_list_init()
%22 = tail call i32 @list_add_node(%struct.node* %21, i32 1)
%23 = tail call i32 @list_add_node(%struct.node* %21, i32 2)
%24 = tail call i32 @list_add_nodes(%struct.node* %21, i32 3)
%25 = tail call i32 @list_add_node(%struct.node* %21, i32 2)
%26 = tail call i32 @list_add_node(%struct.node* %21, i32 2)
%27 = tail call i32 @is_circular(%struct.node* %21)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = tail call i32 @circular(%struct.node* %21)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = tail call i32 @list_output(%struct.node* %21)
%32 = tail call %struct.node* @list_reverse(%struct.node* %21)
%33 = tail call i32 @is_circular(%struct.node* %32)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = tail call i32 @circular(%struct.node* %32)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = tail call i32 @list_output(%struct.node* %32)
%38 = tail call %struct.node* @list_delete_nodes(%struct.node* %32, i32 2)
%39 = tail call i32 @list_output(%struct.node* %38)
%40 = tail call i32 @list_free(%struct.node* %38)
ret i32 0
}