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

/* Variables and functions */
scalar_t__ error();
int /*<<< orphan*/ write_color_table(struct msscene *);
int /*<<< orphan*/ write_image_header(struct msscene *);
int /*<<< orphan*/ write_pixels(struct msscene *);
void write_image(struct msscene *ms) {
  write_image_header(ms);
  if (error())
    return;
  write_color_table(ms);
  if (error())
    return;
  write_pixels(ms);
  if (error())
    return;
}


x86 assembly (clang, -O0):
<write_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <write_image_header@plt>
mov    $0x0,%al
call   1050 <error@plt>
cmp    $0x0,%rax
je     116b <write_image+0x2b>
jmp    11a9 <write_image+0x69>
mov    -0x8(%rbp),%rdi
call   1030 <write_color_table@plt>
mov    $0x0,%al
call   1050 <error@plt>
cmp    $0x0,%rax
je     118a <write_image+0x4a>
jmp    11a9 <write_image+0x69>
mov    -0x8(%rbp),%rdi
call   1040 <write_pixels@plt>
mov    $0x0,%al
call   1050 <error@plt>
cmp    $0x0,%rax
je     11a9 <write_image+0x69>
jmp    11a9 <write_image+0x69>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_image>:
push   %rbx
mov    %rdi,%rbx
call   1060 <write_image_header@plt>
xor    %eax,%eax
call   1050 <error@plt>
test   %rax,%rax
jne    1169 <write_image+0x29>
mov    %rbx,%rdi
call   1030 <write_color_table@plt>
xor    %eax,%eax
call   1050 <error@plt>
test   %rax,%rax
je     116b <write_image+0x2b>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <write_pixels@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <error@plt>

LLVM IR (-O0):
%struct.msscene = type { i32 }
define void @write_image(%struct.msscene* %0) {
%2 = alloca %struct.msscene*
store %struct.msscene* %0, %struct.msscene** %2
%3 = load %struct.msscene*, %struct.msscene** %2
%4 = call i32 @write_image_header(%struct.msscene* %3)
%5 = call i64 (...) @error()
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %20
8: ; preds = %1
%9 = load %struct.msscene*, %struct.msscene** %2
%10 = call i32 @write_color_table(%struct.msscene* %9)
%11 = call i64 (...) @error()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %8
br label %20
14: ; preds = %8
%15 = load %struct.msscene*, %struct.msscene** %2
%16 = call i32 @write_pixels(%struct.msscene* %15)
%17 = call i64 (...) @error()
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
br label %20
20: ; preds = %7, %13, %19, %14
ret void
}

LLVM IR (-O2):
%struct.msscene = type { i32 }
define void @write_image(%struct.msscene* %0) {
%2 = tail call i32 @write_image_header(%struct.msscene* %0)
%3 = tail call i64 (...) @error()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = tail call i32 @write_color_table(%struct.msscene* %0)
%7 = tail call i64 (...) @error()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = tail call i32 @write_pixels(%struct.msscene* %0)
%11 = tail call i64 (...) @error()
br label %12
12: ; preds = %9, %5, %1
ret void
}