#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 */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
struct list *list_create();
int /*<<< orphan*/ list_destroy(struct list *);
int /*<<< orphan*/ stderr;
int main(void) {
  struct list *list = NULL;
  list = list_create();
  if (list == NULL) {
    (void)fputs("Failed to create list!\n", stderr);
    return EXIT_FAILURE;
  }
  list_destroy(list);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <list_create@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1183 <main+0x53>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
lea    0xe93(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1198 <main+0x68>
mov    -0x10(%rbp),%rdi
call   1050 <list_destroy@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <list_create@plt>
test   %rax,%rax
je     114e <main+0x1e>
mov    %rax,%rdi
call   1050 <list_destroy@plt>
mov    0x2e84(%rip),%rax
jmp    116a <main+0x3a>
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
lea    0xea2(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.list = type { i32 }
@.str = [24 x i8] c"Failed to create list!\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.list*
store i32 0, i32* %1
store %struct.list* null, %struct.list** %2
%3 = call %struct.list* (...) @list_create()
store %struct.list* %3, %struct.list** %2
%4 = load %struct.list*, %struct.list** %2
%5 = icmp eq %struct.list* %4, null
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fputs(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @EXIT_FAILURE
store i32 %9, i32* %1
br label %14
10: ; preds = %0
%11 = load %struct.list*, %struct.list** %2
%12 = call i32 @list_destroy(%struct.list* %11)
%13 = load i32, i32* @EXIT_SUCCESS
store i32 %13, i32* %1
br label %14
14: ; preds = %10, %6
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
%struct.list = type { i32 }
@.str = [24 x i8] c"Failed to create list!\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call %struct.list* (...) @list_create()
%2 = icmp eq %struct.list* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fputs(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %8
6: ; preds = %0
%7 = tail call i32 @list_destroy(%struct.list* %1)
br label %8
8: ; preds = %6, %3
%9 = phi i32* [ @EXIT_FAILURE, %3 ], [ @EXIT_SUCCESS, %6 ]
%10 = load i32, i32* %9
ret i32 %10
}