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

/* Variables and functions */
int /*<<< orphan*/ free_list(struct element *);
int /*<<< orphan*/ print_list(struct element *);
int /*<<< orphan*/ printf(char *);
struct element *prompt_list();
int /*<<< orphan*/ rmEvens(struct element **);
int main(void) {
  struct element *l = prompt_list();
  printf("Got the following list: ");
  print_list(l);
  printf("Removing evens: ");
  rmEvens(&l);
  print_list(l);
  free_list(l);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <prompt_list@plt>
mov    %rax,-0x10(%rbp)
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <print_list@plt>
lea    0xe93(%rip),%rdi
call   1050 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1030 <rmEvens@plt>
mov    -0x10(%rbp),%rdi
call   1040 <print_list@plt>
mov    -0x10(%rbp),%rdi
call   1060 <free_list@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1070 <prompt_list@plt>
mov    %rax,%rbx
mov    %rax,0x8(%rsp)
lea    0xe95(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <print_list@plt>
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
lea    0x8(%rsp),%rdi
call   1030 <rmEvens@plt>
mov    0x8(%rsp),%rdi
call   1040 <print_list@plt>
mov    0x8(%rsp),%rdi
call   1060 <free_list@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.element = type { i32 }
@.str = [25 x i8] c"Got the following list: \00"
@.str.1 = [17 x i8] c"Removing evens: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.element*
store i32 0, i32* %1
%3 = call %struct.element* (...) @prompt_list()
store %struct.element* %3, %struct.element** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = load %struct.element*, %struct.element** %2
%6 = call i32 @print_list(%struct.element* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @rmEvens(%struct.element** %2)
%9 = load %struct.element*, %struct.element** %2
%10 = call i32 @print_list(%struct.element* %9)
%11 = load %struct.element*, %struct.element** %2
%12 = call i32 @free_list(%struct.element* %11)
ret i32 0
}

LLVM IR (-O2):
%struct.element = type { i32 }
@.str = [25 x i8] c"Got the following list: \00"
@.str.1 = [17 x i8] c"Removing evens: \00"
define i32 @main() {
%1 = alloca %struct.element*
%2 = bitcast %struct.element** %1 to i8*
%3 = tail call %struct.element* (...) @prompt_list()
store %struct.element* %3, %struct.element** %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @print_list(%struct.element* %3)
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @rmEvens(%struct.element** %1)
%8 = load %struct.element*, %struct.element** %1
%9 = call i32 @print_list(%struct.element* %8)
%10 = load %struct.element*, %struct.element** %1
%11 = call i32 @free_list(%struct.element* %10)
ret i32 0
}