#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
scalar_t__ mem_bit_test(int, int);
int /*<<< orphan*/ screen_draw_line_bg(int /*<<< orphan*/);
int /*<<< orphan*/ screen_draw_line_fb(int /*<<< orphan*/);
int /*<<< orphan*/ screen_draw_line_obj(int /*<<< orphan*/);
int /*<<< orphan*/ screen_draw_line_win(int /*<<< orphan*/);
void screen_draw_line(uint8_t line) {
  if (mem_bit_test(0xFF40, (0x01 << 0))) {
    screen_draw_line_bg(line);
  }
  if (mem_bit_test(0xFF40, (0x01 << 5))) {
    screen_draw_line_win(line);
  }
  if (mem_bit_test(0xFF40, (0x01 << 1))) {
    screen_draw_line_obj(line);
  }
  screen_draw_line_fb(line);
}


x86 assembly (clang, -O0):
<screen_draw_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xff40,%edi
mov    $0x1,%esi
call   1060 <mem_bit_test@plt>
cmp    $0x0,%rax
je     117c <screen_draw_line+0x2c>
mov    -0x4(%rbp),%edi
call   1030 <screen_draw_line_bg@plt>
mov    $0xff40,%edi
mov    $0x20,%esi
call   1060 <mem_bit_test@plt>
cmp    $0x0,%rax
je     119d <screen_draw_line+0x4d>
mov    -0x4(%rbp),%edi
call   1050 <screen_draw_line_win@plt>
mov    $0xff40,%edi
mov    $0x2,%esi
call   1060 <mem_bit_test@plt>
cmp    $0x0,%rax
je     11be <screen_draw_line+0x6e>
mov    -0x4(%rbp),%edi
call   1070 <screen_draw_line_obj@plt>
mov    -0x4(%rbp),%edi
call   1040 <screen_draw_line_fb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<screen_draw_line>:
push   %rbx
mov    %edi,%ebx
mov    $0xff40,%edi
mov    $0x1,%esi
call   1060 <mem_bit_test@plt>
test   %rax,%rax
je     116e <screen_draw_line+0x1e>
mov    %ebx,%edi
call   1030 <screen_draw_line_bg@plt>
mov    $0xff40,%edi
mov    $0x20,%esi
call   1060 <mem_bit_test@plt>
test   %rax,%rax
je     1189 <screen_draw_line+0x39>
mov    %ebx,%edi
call   1050 <screen_draw_line_win@plt>
mov    $0xff40,%edi
mov    $0x2,%esi
call   1060 <mem_bit_test@plt>
test   %rax,%rax
je     11a4 <screen_draw_line+0x54>
mov    %ebx,%edi
call   1070 <screen_draw_line_obj@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <screen_draw_line_fb@plt>

LLVM IR (-O0):
define void @screen_draw_line(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 @mem_bit_test(i32 65344, i32 1)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @screen_draw_line_bg(i32 %6)
br label %8
8: ; preds = %5, %1
%9 = call i64 @mem_bit_test(i32 65344, i32 32)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = call i32 @screen_draw_line_win(i32 %12)
br label %14
14: ; preds = %11, %8
%15 = call i64 @mem_bit_test(i32 65344, i32 2)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = call i32 @screen_draw_line_obj(i32 %18)
br label %20
20: ; preds = %17, %14
%21 = load i32, i32* %2
%22 = call i32 @screen_draw_line_fb(i32 %21)
ret void
}

LLVM IR (-O2):
define void @screen_draw_line(i32 %0) {
%2 = tail call i64 @mem_bit_test(i32 65344, i32 1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @screen_draw_line_bg(i32 %0)
br label %6
6: ; preds = %4, %1
%7 = tail call i64 @mem_bit_test(i32 65344, i32 32)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @screen_draw_line_win(i32 %0)
br label %11
11: ; preds = %9, %6
%12 = tail call i64 @mem_bit_test(i32 65344, i32 2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @screen_draw_line_obj(i32 %0)
br label %16
16: ; preds = %14, %11
%17 = tail call i32 @screen_draw_line_fb(i32 %0)
ret void
}