#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 */

/* Variables and functions */
int epdc_get_next_lut();
scalar_t__ epdc_is_lut_active(int);
scalar_t__ epdc_is_working_buffer_busy();
int /*<<< orphan*/ epdc_set_update_addr(int);
int /*<<< orphan*/ epdc_set_update_coord(int /*<<< orphan*/,
                                         int /*<<< orphan*/);
int /*<<< orphan*/ epdc_set_update_dimensions(int, int);
int /*<<< orphan*/ epdc_submit_update(int, int /*<<< orphan*/, int, int, int);
void epdc_send_mode0_to_black_update(void) {
  int lut = 15;
  while (epdc_is_working_buffer_busy())
    ;
  lut = epdc_get_next_lut();
  epdc_set_update_addr(0x73200000);
  epdc_set_update_coord(0, 0);
  epdc_set_update_dimensions(800, 600);
  epdc_submit_update(lut, 0, 0x1, 0x0, 0x0);
  while (epdc_is_lut_active(lut))
    ;
}


x86 assembly (clang, -O0):
<epdc_send_mode0_to_black_update>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xf,-0x4(%rbp)
mov    $0x0,%al
call   1040 <epdc_is_working_buffer_busy@plt>
cmp    $0x0,%rax
je     1195 <epdc_send_mode0_to_black_update+0x25>
jmp    117f <epdc_send_mode0_to_black_update+0xf>
mov    $0x0,%al
call   1090 <epdc_get_next_lut@plt>
mov    %eax,-0x4(%rbp)
mov    $0x73200000,%edi
call   1050 <epdc_set_update_addr@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <epdc_set_update_coord@plt>
mov    $0x320,%edi
mov    $0x258,%esi
call   1060 <epdc_set_update_dimensions@plt>
mov    -0x4(%rbp),%edi
xor    %r8d,%r8d
mov    $0x1,%edx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1070 <epdc_submit_update@plt>
mov    -0x4(%rbp),%edi
call   1080 <epdc_is_lut_active@plt>
cmp    $0x0,%rax
je     11ee <epdc_send_mode0_to_black_update+0x7e>
jmp    11d7 <epdc_send_mode0_to_black_update+0x67>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epdc_send_mode0_to_black_update>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <epdc_is_working_buffer_busy@plt>
test   %rax,%rax
jne    1180 <epdc_send_mode0_to_black_update+0x10>
xor    %eax,%eax
call   1090 <epdc_get_next_lut@plt>
mov    %eax,%ebx
mov    $0x73200000,%edi
call   1050 <epdc_set_update_addr@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <epdc_set_update_coord@plt>
mov    $0x320,%edi
mov    $0x258,%esi
call   1060 <epdc_set_update_dimensions@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1070 <epdc_submit_update@plt>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1080 <epdc_is_lut_active@plt>
test   %rax,%rax
jne    11d0 <epdc_send_mode0_to_black_update+0x60>
pop    %rbx
ret

LLVM IR (-O0):
define void @epdc_send_mode0_to_black_update() {
%1 = alloca i32
store i32 15, i32* %1
br label %2
2: ; preds = %5, %0
%3 = call i64 (...) @epdc_is_working_buffer_busy()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
br label %2
6: ; preds = %2
%7 = call i32 (...) @epdc_get_next_lut()
store i32 %7, i32* %1
%8 = call i32 @epdc_set_update_addr(i32 1931476992)
%9 = call i32 @epdc_set_update_coord(i32 0, i32 0)
%10 = call i32 @epdc_set_update_dimensions(i32 800, i32 600)
%11 = load i32, i32* %1
%12 = call i32 @epdc_submit_update(i32 %11, i32 0, i32 1, i32 0, i32 0)
br label %13
13: ; preds = %17, %6
%14 = load i32, i32* %1
%15 = call i64 @epdc_is_lut_active(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
br label %13
18: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @epdc_send_mode0_to_black_update() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 (...) @epdc_is_working_buffer_busy()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %1
4: ; preds = %1
%5 = tail call i32 (...) @epdc_get_next_lut()
%6 = tail call i32 @epdc_set_update_addr(i32 1931476992)
%7 = tail call i32 @epdc_set_update_coord(i32 0, i32 0)
%8 = tail call i32 @epdc_set_update_dimensions(i32 800, i32 600)
%9 = tail call i32 @epdc_submit_update(i32 %5, i32 0, i32 1, i32 0, i32 0)
br label %10
10: ; preds = %10, %4
%11 = tail call i64 @epdc_is_lut_active(i32 %5)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %10
13: ; preds = %10
ret void
}