#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 /*<<< orphan*/ WRITE_FB32(unsigned long, int);
void gfx_set_cursor_shape32(unsigned long memoffset, unsigned long *andmask,
                            unsigned long *xormask) {
  int i;
  for (i = 0; i < 32; i++) {
    WRITE_FB32(memoffset, 0xFFFFFFFF);
    WRITE_FB32(memoffset + 4, andmask[i]);
    WRITE_FB32(memoffset + 8, 0x00000000);
    WRITE_FB32(memoffset + 12, xormask[i]);
    memoffset += 16;
  }
  for (i = 0; i < 32; i++) {
    WRITE_FB32(memoffset, 0xFFFFFFFF);
    WRITE_FB32(memoffset + 4, 0xFFFFFFFF);
    WRITE_FB32(memoffset + 8, 0x00000000);
    WRITE_FB32(memoffset + 12, 0x00000000);
    memoffset += 16;
  }
}


x86 assembly (clang, -O0):
<gfx_set_cursor_shape32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    11a2 <gfx_set_cursor_shape32+0x92>
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
xor    %esi,%esi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0xc,%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <gfx_set_cursor_shape32+0x1b>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    120b <gfx_set_cursor_shape32+0xfb>
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    $0xffffffff,%esi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
xor    %esi,%esi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0xc,%rdi
xor    %esi,%esi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a9 <gfx_set_cursor_shape32+0x99>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfx_set_cursor_shape32>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%rdi
mov    $0xffffffff,%esi
call   1030 <WRITE_FB32@plt>
mov    (%r15,%r13,1),%esi
lea    (%r12,%rbx,1),%rdi
add    $0x4,%rdi
call   1030 <WRITE_FB32@plt>
lea    (%r12,%rbx,1),%rdi
add    $0x8,%rdi
xor    %esi,%esi
call   1030 <WRITE_FB32@plt>
mov    (%r14,%r13,1),%esi
lea    (%r12,%rbx,1),%rdi
add    $0xc,%rdi
call   1030 <WRITE_FB32@plt>
add    $0x8,%r13
add    $0x10,%rbx
cmp    $0x200,%rbx
jne    1130 <gfx_set_cursor_shape32+0x20>
add    %rbx,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%r12,%rbx,1),%rdi
mov    $0xffffffff,%esi
call   1030 <WRITE_FB32@plt>
lea    (%r12,%rbx,1),%rdi
add    $0x4,%rdi
mov    $0xffffffff,%esi
call   1030 <WRITE_FB32@plt>
lea    (%r12,%rbx,1),%rdi
add    $0x8,%rdi
xor    %esi,%esi
call   1030 <WRITE_FB32@plt>
lea    (%r12,%rbx,1),%rdi
add    $0xc,%rdi
xor    %esi,%esi
call   1030 <WRITE_FB32@plt>
add    $0x10,%rbx
cmp    $0x200,%ebx
jne    1190 <gfx_set_cursor_shape32+0x80>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @gfx_set_cursor_shape32(i64 %0, i64* %1, i64* %2) {
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i32
store i64 %0, i64* %4
store i64* %1, i64** %5
store i64* %2, i64** %6
store i32 0, i32* %7
br label %8
8: ; preds = %37, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 32
br i1 %10, label %11, label %40
11: ; preds = %8
%12 = load i64, i64* %4
%13 = call i32 @WRITE_FB32(i64 %12, i32 -1)
%14 = load i64, i64* %4
%15 = add i64 %14, 4
%16 = load i64*, i64** %5
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i64, i64* %16, i64 %18
%20 = load i64, i64* %19
%21 = trunc i64 %20 to i32
%22 = call i32 @WRITE_FB32(i64 %15, i32 %21)
%23 = load i64, i64* %4
%24 = add i64 %23, 8
%25 = call i32 @WRITE_FB32(i64 %24, i32 0)
%26 = load i64, i64* %4
%27 = add i64 %26, 12
%28 = load i64*, i64** %6
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i64, i64* %28, i64 %30
%32 = load i64, i64* %31
%33 = trunc i64 %32 to i32
%34 = call i32 @WRITE_FB32(i64 %27, i32 %33)
%35 = load i64, i64* %4
%36 = add i64 %35, 16
store i64 %36, i64* %4
br label %37
37: ; preds = %11
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %8
40: ; preds = %8
store i32 0, i32* %7
br label %41
41: ; preds = %58, %40
%42 = load i32, i32* %7
%43 = icmp slt i32 %42, 32
br i1 %43, label %44, label %61
44: ; preds = %41
%45 = load i64, i64* %4
%46 = call i32 @WRITE_FB32(i64 %45, i32 -1)
%47 = load i64, i64* %4
%48 = add i64 %47, 4
%49 = call i32 @WRITE_FB32(i64 %48, i32 -1)
%50 = load i64, i64* %4
%51 = add i64 %50, 8
%52 = call i32 @WRITE_FB32(i64 %51, i32 0)
%53 = load i64, i64* %4
%54 = add i64 %53, 12
%55 = call i32 @WRITE_FB32(i64 %54, i32 0)
%56 = load i64, i64* %4
%57 = add i64 %56, 16
store i64 %57, i64* %4
br label %58
58: ; preds = %44
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %41
61: ; preds = %41
ret void
}

LLVM IR (-O2):
define void @gfx_set_cursor_shape32(i64 %0, i64* nocapture %1, i64* nocapture %2) {
br label %4
4: ; preds = %3, %4
%5 = phi i64 [ 0, %3 ], [ %21, %4 ]
%6 = phi i64 [ %0, %3 ], [ %20, %4 ]
%7 = tail call i32 @WRITE_FB32(i64 %6, i32 -1)
%8 = add i64 %6, 4
%9 = getelementptr inbounds i64, i64* %1, i64 %5
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = tail call i32 @WRITE_FB32(i64 %8, i32 %11)
%13 = add i64 %6, 8
%14 = tail call i32 @WRITE_FB32(i64 %13, i32 0)
%15 = add i64 %6, 12
%16 = getelementptr inbounds i64, i64* %2, i64 %5
%17 = load i64, i64* %16
%18 = trunc i64 %17 to i32
%19 = tail call i32 @WRITE_FB32(i64 %15, i32 %18)
%20 = add i64 %6, 16
%21 = add nuw nsw i64 %5, 1
%22 = icmp eq i64 %21, 32
br i1 %22, label %23, label %4
23: ; preds = %4, %23
%24 = phi i32 [ %34, %23 ], [ 0, %4 ]
%25 = phi i64 [ %33, %23 ], [ %20, %4 ]
%26 = tail call i32 @WRITE_FB32(i64 %25, i32 -1)
%27 = add i64 %25, 4
%28 = tail call i32 @WRITE_FB32(i64 %27, i32 -1)
%29 = add i64 %25, 8
%30 = tail call i32 @WRITE_FB32(i64 %29, i32 0)
%31 = add i64 %25, 12
%32 = tail call i32 @WRITE_FB32(i64 %31, i32 0)
%33 = add i64 %25, 16
%34 = add nuw nsw i32 %24, 1
%35 = icmp eq i32 %34, 32
br i1 %35, label %36, label %23
36: ; preds = %23
ret void
}