#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 */

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ print_list();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("\n---- Running test1-1 ---\n");
  printf("Before any allocation\n");
  print_list();
  int *mem1 = (int *)malloc(8);
  *mem1 = 10;
  printf("mem1 = malloc(8)\n");
  print_list();
  exit(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)
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <print_list@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0xa,(%rax)
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <print_list@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <print_list@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
movl   $0xa,(%rax)
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <print_list@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"\0A---- Running test1-1 ---\0A\00"
@.str.1 = [23 x i8] c"Before any allocation\0A\00"
@.str.2 = [18 x i8] c"mem1 = malloc(8)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (...) @print_list()
%10 = call i64 @malloc(i32 8)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %6
%12 = load i32*, i32** %6
store i32 10, i32* %12
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (...) @print_list()
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [26 x i8] c"\0A---- Running test1-1 ---\00"
@str.3 = [22 x i8] c"Before any allocation\00"
@str.4 = [17 x i8] c"mem1 = malloc(8)\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
%5 = tail call i32 (...) @print_list()
%6 = tail call i64 @malloc(i32 8)
%7 = inttoptr i64 %6 to i32*
store i32 10, i32* %7
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
%9 = tail call i32 (...) @print_list()
%10 = tail call i32 @exit(i32 0)
unreachable
}