#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 list {
  int dummy;
};

/* Variables and functions */
struct list *list_init(int);
int /*<<< orphan*/ list_print(struct list *);
struct list *list_reverse(struct list *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int ret;
  int len;
  struct list *head = NULL;
  printf("input length:");
  scanf("%d", &len);
  head = list_init(len);
  list_print(head);
  head = list_reverse(head);
  list_print(head);
  return ret;
}


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)
movq   $0x0,-0x20(%rbp)
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x18(%rbp),%edi
call   1050 <list_init@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <list_print@plt>
mov    -0x20(%rbp),%rdi
call   1060 <list_reverse@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <list_print@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
call   1050 <list_init@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <list_print@plt>
mov    %rbx,%rdi
call   1060 <list_reverse@plt>
mov    %rax,%rdi
call   1040 <list_print@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.list = type { i32 }
@.str = [14 x i8] c"input length:\00"
@.str.1 = [3 x i8] c"%d\00"
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.list*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.list* null, %struct.list** %8
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%11 = load i32, i32* %7
%12 = call %struct.list* @list_init(i32 %11)
store %struct.list* %12, %struct.list** %8
%13 = load %struct.list*, %struct.list** %8
%14 = call i32 @list_print(%struct.list* %13)
%15 = load %struct.list*, %struct.list** %8
%16 = call %struct.list* @list_reverse(%struct.list* %15)
store %struct.list* %16, %struct.list** %8
%17 = load %struct.list*, %struct.list** %8
%18 = call i32 @list_print(%struct.list* %17)
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
%struct.list = type { i32 }
@.str = [14 x i8] c"input length:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call %struct.list* @list_init(i32 %7)
%9 = call i32 @list_print(%struct.list* %8)
%10 = call %struct.list* @list_reverse(%struct.list* %8)
%11 = call i32 @list_print(%struct.list* %10)
ret i32 undef
}