#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, unsigned long);
void gfx_set_cursor_shape64(unsigned long memoffset, unsigned long *andmask,
                            unsigned long *xormask) {
  int i;
  for (i = 0; i < 128; i += 2) {
    WRITE_FB32(memoffset, andmask[i + 1]);
    WRITE_FB32(memoffset + 4, andmask[i]);
    WRITE_FB32(memoffset + 8, xormask[i + 1]);
    WRITE_FB32(memoffset + 12, xormask[i]);
    memoffset += 16;
  }
}


x86 assembly (clang, -O0):
<gfx_set_cursor_shape64>:
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   $0x80,-0x1c(%rbp)
jge    11bc <gfx_set_cursor_shape64+0xac>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rdi
add    $0xc,%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <gfx_set_cursor_shape64+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfx_set_cursor_shape64>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    $0xfffffffffffffffe,%rbx
nopl   0x0(%rax,%rax,1)
mov    0x18(%r15,%rbx,8),%rsi
mov    %r12,%rdi
call   1030 <WRITE_FB32@plt>
lea    0x4(%r12),%rdi
mov    0x10(%r15,%rbx,8),%rsi
call   1030 <WRITE_FB32@plt>
mov    0x18(%r14,%rbx,8),%rsi
lea    0x8(%r12),%rdi
call   1030 <WRITE_FB32@plt>
mov    0x10(%r14,%rbx,8),%rsi
lea    0xc(%r12),%rdi
call   1030 <WRITE_FB32@plt>
add    $0x2,%rbx
add    $0x10,%r12
cmp    $0x7e,%rbx
jb     1130 <gfx_set_cursor_shape64+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @gfx_set_cursor_shape64(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 = %47, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 128
br i1 %10, label %11, label %50
11: ; preds = %8
%12 = load i64, i64* %4
%13 = load i64*, i64** %5
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i64, i64* %13, i64 %16
%18 = load i64, i64* %17
%19 = call i32 @WRITE_FB32(i64 %12, i64 %18)
%20 = load i64, i64* %4
%21 = add i64 %20, 4
%22 = load i64*, i64** %5
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i64, i64* %22, i64 %24
%26 = load i64, i64* %25
%27 = call i32 @WRITE_FB32(i64 %21, i64 %26)
%28 = load i64, i64* %4
%29 = add i64 %28, 8
%30 = load i64*, i64** %6
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i64, i64* %30, i64 %33
%35 = load i64, i64* %34
%36 = call i32 @WRITE_FB32(i64 %29, i64 %35)
%37 = load i64, i64* %4
%38 = add i64 %37, 12
%39 = load i64*, i64** %6
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i64, i64* %39, i64 %41
%43 = load i64, i64* %42
%44 = call i32 @WRITE_FB32(i64 %38, i64 %43)
%45 = load i64, i64* %4
%46 = add i64 %45, 16
store i64 %46, i64* %4
br label %47
47: ; preds = %11
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 2
store i32 %49, i32* %7
br label %8
50: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @gfx_set_cursor_shape64(i64 %0, i64* nocapture %1, i64* nocapture %2) {
br label %4
4: ; preds = %3, %4
%5 = phi i64 [ 0, %3 ], [ %24, %4 ]
%6 = phi i64 [ %0, %3 ], [ %23, %4 ]
%7 = or i64 %5, 1
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = load i64, i64* %8
%10 = tail call i32 @WRITE_FB32(i64 %6, i64 %9)
%11 = add i64 %6, 4
%12 = getelementptr inbounds i64, i64* %1, i64 %5
%13 = load i64, i64* %12
%14 = tail call i32 @WRITE_FB32(i64 %11, i64 %13)
%15 = add i64 %6, 8
%16 = getelementptr inbounds i64, i64* %2, i64 %7
%17 = load i64, i64* %16
%18 = tail call i32 @WRITE_FB32(i64 %15, i64 %17)
%19 = add i64 %6, 12
%20 = getelementptr inbounds i64, i64* %2, i64 %5
%21 = load i64, i64* %20
%22 = tail call i32 @WRITE_FB32(i64 %19, i64 %21)
%23 = add i64 %6, 16
%24 = add nuw nsw i64 %5, 2
%25 = icmp ult i64 %5, 126
br i1 %25, label %4, label %26
26: ; preds = %4
ret void
}