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

/* Variables and functions */
int /*<<< orphan*/ Clean_meta(char *);
char *Get_fd_image(int, int);
int /*<<< orphan*/ Split(struct line_list *, char *, char const *, int,
                         char const *, int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int Get_fd_image_and_split(int fd, int maxsize, int clean, struct line_list *l,
                           const char *sep, int sort, const char *keysep,
                           int uniq, int trim, int nocomments,
                           char **return_image) {
  char *s = 0;
  if (return_image)
    *return_image = 0;
  s = Get_fd_image(fd, maxsize);
  if (s == 0)
    return 1;
  if (clean)
    Clean_meta(s);
  Split(l, s, sep, sort, keysep, uniq, trim, nocomments, 0);
  if (return_image) {
    *return_image = s;
  } else {
    if (s)
      free(s);
    s = 0;
  }
  return (0);
}


x86 assembly (clang, -O0):
<Get_fd_image_and_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x0,0x30(%rbp)
je     118c <Get_fd_image_and_split+0x4c>
mov    0x30(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <Get_fd_image@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11b2 <Get_fd_image_and_split+0x72>
movl   $0x1,-0x4(%rbp)
jmp    1239 <Get_fd_image_and_split+0xf9>
cmpl   $0x0,-0x10(%rbp)
je     11c5 <Get_fd_image_and_split+0x85>
mov    -0x30(%rbp),%rdi
call   1030 <Clean_meta@plt>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    0x10(%rbp),%r8
mov    0x18(%rbp),%r9d
mov    0x20(%rbp),%r10d
mov    0x28(%rbp),%eax
xor    %r11d,%r11d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1060 <Split@plt>
cmpq   $0x0,0x30(%rbp)
je     1216 <Get_fd_image_and_split+0xd6>
mov    -0x30(%rbp),%rcx
mov    0x30(%rbp),%rax
mov    %rcx,(%rax)
jmp    1232 <Get_fd_image_and_split+0xf2>
cmpq   $0x0,-0x30(%rbp)
je     122a <Get_fd_image_and_split+0xea>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_fd_image_and_split>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8,%r15
mov    %rcx,%r12
mov    %edx,%r13d
mov    0x60(%rsp),%rax
test   %rax,%rax
je     1168 <Get_fd_image_and_split+0x28>
movq   $0x0,(%rax)
call   1050 <Get_fd_image@plt>
test   %rax,%rax
je     11d0 <Get_fd_image_and_split+0x90>
mov    %rax,%rbx
mov    0x58(%rsp),%ebp
mov    0x50(%rsp),%eax
mov    0x48(%rsp),%r9d
mov    0x40(%rsp),%r8
test   %r13d,%r13d
je     11a4 <Get_fd_image_and_split+0x64>
mov    %rbx,%rdi
mov    %rax,%r13
call   1030 <Clean_meta@plt>
mov    0x40(%rsp),%r8
mov    0x48(%rsp),%r9d
mov    %r13,%rax
sub    $0x8,%rsp
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
push   $0x0
push   %rbp
push   %rax
call   1060 <Split@plt>
add    $0x20,%rsp
mov    0x60(%rsp),%rax
test   %rax,%rax
je     11d7 <Get_fd_image_and_split+0x97>
mov    %rbx,(%rax)
jmp    11df <Get_fd_image_and_split+0x9f>
mov    $0x1,%eax
jmp    11e1 <Get_fd_image_and_split+0xa1>
mov    %rbx,%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.line_list = type { i32 }
define i32 @Get_fd_image_and_split(i32 %0, i32 %1, i32 %2, %struct.line_list* %3, i8* %4, i32 %5, i8* %6, i32 %7, i32 %8, i32 %9, i8** %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca %struct.line_list*
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i8**
%24 = alloca i8*
store i32 %0, i32* %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store %struct.line_list* %3, %struct.line_list** %16
store i8* %4, i8** %17
store i32 %5, i32* %18
store i8* %6, i8** %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store i32 %9, i32* %22
store i8** %10, i8*** %23
store i8* null, i8** %24
%25 = load i8**, i8*** %23
%26 = icmp ne i8** %25, null
br i1 %26, label %27, label %29
27: ; preds = %11
%28 = load i8**, i8*** %23
store i8* null, i8** %28
br label %29
29: ; preds = %27, %11
%30 = load i32, i32* %13
%31 = load i32, i32* %14
%32 = call i8* @Get_fd_image(i32 %30, i32 %31)
store i8* %32, i8** %24
%33 = load i8*, i8** %24
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %36
35: ; preds = %29
store i32 1, i32* %12
br label %65
36: ; preds = %29
%37 = load i32, i32* %15
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i8*, i8** %24
%41 = call i32 @Clean_meta(i8* %40)
br label %42
42: ; preds = %39, %36
%43 = load %struct.line_list*, %struct.line_list** %16
%44 = load i8*, i8** %24
%45 = load i8*, i8** %17
%46 = load i32, i32* %18
%47 = load i8*, i8** %19
%48 = load i32, i32* %20
%49 = load i32, i32* %21
%50 = load i32, i32* %22
%51 = call i32 @Split(%struct.line_list* %43, i8* %44, i8* %45, i32 %46, i8* %47, i32 %48, i32 %49, i32 %50, i32 0)
%52 = load i8**, i8*** %23
%53 = icmp ne i8** %52, null
br i1 %53, label %54, label %57
54: ; preds = %42
%55 = load i8*, i8** %24
%56 = load i8**, i8*** %23
store i8* %55, i8** %56
br label %64
57: ; preds = %42
%58 = load i8*, i8** %24
%59 = icmp ne i8* %58, null
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i8*, i8** %24
%62 = call i32 @free(i8* %61)
br label %63
63: ; preds = %60, %57
store i8* null, i8** %24
br label %64
64: ; preds = %63, %54
store i32 0, i32* %12
br label %65
65: ; preds = %64, %35
%66 = load i32, i32* %12
ret i32 %66
}

LLVM IR (-O2):
%struct.line_list = type { i32 }
define i32 @Get_fd_image_and_split(i32 %0, i32 %1, i32 %2, %struct.line_list* %3, i8* %4, i32 %5, i8* %6, i32 %7, i32 %8, i32 %9, i8** writeonly %10) {
%12 = icmp eq i8** %10, null
br i1 %12, label %14, label %13
13: ; preds = %11
store i8* null, i8** %10
br label %14
14: ; preds = %13, %11
%15 = tail call i8* @Get_fd_image(i32 %0, i32 %1)
%16 = icmp eq i8* %15, null
br i1 %16, label %26, label %17
17: ; preds = %14
%18 = icmp eq i32 %2, 0
br i1 %18, label %21, label %19
19: ; preds = %17
%20 = tail call i32 @Clean_meta(i8* %15)
br label %21
21: ; preds = %19, %17
%22 = tail call i32 @Split(%struct.line_list* %3, i8* %15, i8* %4, i32 %5, i8* %6, i32 %7, i32 %8, i32 %9, i32 0)
br i1 %12, label %24, label %23
23: ; preds = %21
store i8* %15, i8** %10
br label %26
24: ; preds = %21
%25 = tail call i32 @free(i8* %15)
br label %26
26: ; preds = %23, %24, %14
%27 = phi i32 [ 1, %14 ], [ 0, %24 ], [ 0, %23 ]
ret i32 %27
}