#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 saxs_document {
  int dummy;
};
struct line {
  int dummy;
};

/* Variables and functions */
int ENOMEM;
int /*<<< orphan*/ lines_append(struct line **, struct line *);
struct line *lines_create();
int csv_write_header(struct saxs_document *doc, struct line **lines) {
  struct line *line;
  line = lines_create();
  if (!line) {
    return ENOMEM;
  }
  lines_append(lines, line);
  return 0;
}


x86 assembly (clang, -O0):
<csv_write_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x0,%al
call   1030 <lines_create@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1157 <csv_write_header+0x37>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    116b <csv_write_header+0x4b>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <lines_append@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csv_write_header>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <lines_create@plt>
test   %rax,%rax
je     1142 <csv_write_header+0x22>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <lines_append@plt>
jmp    114b <csv_write_header+0x2b>
mov    0x2e97(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.saxs_document = type { i32 }
%struct.line = type { i32 }
@ENOMEM = global i32 0
define i32 @csv_write_header(%struct.saxs_document* %0, %struct.line** %1) {
%3 = alloca i32
%4 = alloca %struct.saxs_document*
%5 = alloca %struct.line**
%6 = alloca %struct.line*
store %struct.saxs_document* %0, %struct.saxs_document** %4
store %struct.line** %1, %struct.line*** %5
%7 = call %struct.line* (...) @lines_create()
store %struct.line* %7, %struct.line** %6
%8 = load %struct.line*, %struct.line** %6
%9 = icmp ne %struct.line* %8, null
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = load i32, i32* @ENOMEM
store i32 %11, i32* %3
br label %16
12: ; preds = %2
%13 = load %struct.line**, %struct.line*** %5
%14 = load %struct.line*, %struct.line** %6
%15 = call i32 @lines_append(%struct.line** %13, %struct.line* %14)
store i32 0, i32* %3
br label %16
16: ; preds = %12, %10
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
%struct.saxs_document = type { i32 }
%struct.line = type { i32 }
@ENOMEM = global i32 0
define i32 @csv_write_header(%struct.saxs_document* nocapture readnone %0, %struct.line** %1) {
%3 = tail call %struct.line* (...) @lines_create()
%4 = icmp eq %struct.line* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = load i32, i32* @ENOMEM
br label %9
7: ; preds = %2
%8 = tail call i32 @lines_append(%struct.line** %1, %struct.line* %3)
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 0, %7 ], [ %6, %5 ]
ret i32 %10
}