#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_shape32(unsigned long memoffset, unsigned long *andmask,
                            unsigned long *xormask) {
  int i;
  unsigned long value;
  for (i = 0; i < 32; i++) {
    value = (andmask[i] & 0xFFFF0000) | (xormask[i] >> 16);
    WRITE_FB32(memoffset, value);
    memoffset += 4;
    value = (andmask[i] << 16) | (xormask[i] & 0x0000FFFF);
    WRITE_FB32(memoffset, value);
    memoffset += 4;
  }
}


x86 assembly (clang, -O0):
<gfx_set_cursor_shape32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    11cc <gfx_set_cursor_shape32+0xbc>
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movabs $0xffff0000,%rax
and    (%rcx,%rdx,8),%rax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
shr    $0x10,%rcx
or     %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
shl    $0x10,%rax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
and    $0xffff,%rcx
or     %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <WRITE_FB32@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <gfx_set_cursor_shape32+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfx_set_cursor_shape32>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r12,%rbx,1),%rdi
movzwl 0x2(%r15,%rbx,1),%eax
shl    $0x10,%rax
mov    (%r14,%rbx,1),%rsi
shr    $0x10,%rsi
or     %rax,%rsi
call   1030 <WRITE_FB32@plt>
mov    (%r15,%rbx,1),%rax
shl    $0x10,%rax
movzwl (%r14,%rbx,1),%esi
or     %rax,%rsi
lea    (%r12,%rbx,1),%rdi
add    $0x4,%rdi
call   1030 <WRITE_FB32@plt>
add    $0x8,%rbx
cmp    $0x100,%rbx
jne    1130 <gfx_set_cursor_shape32+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
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
%8 = alloca i64
store i64 %0, i64* %4
store i64* %1, i64** %5
store i64* %2, i64** %6
store i32 0, i32* %7
br label %9
9: ; preds = %49, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 32
br i1 %11, label %12, label %52
12: ; preds = %9
%13 = load i64*, i64** %5
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i64, i64* %13, i64 %15
%17 = load i64, i64* %16
%18 = and i64 %17, 4294901760
%19 = load i64*, i64** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i64, i64* %19, i64 %21
%23 = load i64, i64* %22
%24 = lshr i64 %23, 16
%25 = or i64 %18, %24
store i64 %25, i64* %8
%26 = load i64, i64* %4
%27 = load i64, i64* %8
%28 = call i32 @WRITE_FB32(i64 %26, i64 %27)
%29 = load i64, i64* %4
%30 = add i64 %29, 4
store i64 %30, i64* %4
%31 = load i64*, i64** %5
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i64, i64* %31, i64 %33
%35 = load i64, i64* %34
%36 = shl i64 %35, 16
%37 = load i64*, i64** %6
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i64, i64* %37, i64 %39
%41 = load i64, i64* %40
%42 = and i64 %41, 65535
%43 = or i64 %36, %42
store i64 %43, i64* %8
%44 = load i64, i64* %4
%45 = load i64, i64* %8
%46 = call i32 @WRITE_FB32(i64 %44, i64 %45)
%47 = load i64, i64* %4
%48 = add i64 %47, 4
store i64 %48, i64* %4
br label %49
49: ; preds = %12
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
store i32 %51, i32* %7
br label %9
52: ; preds = %9
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 ], [ %23, %4 ]
%6 = phi i64 [ %0, %3 ], [ %22, %4 ]
%7 = getelementptr inbounds i64, i64* %1, i64 %5
%8 = load i64, i64* %7
%9 = and i64 %8, 4294901760
%10 = getelementptr inbounds i64, i64* %2, i64 %5
%11 = load i64, i64* %10
%12 = lshr i64 %11, 16
%13 = or i64 %12, %9
%14 = tail call i32 @WRITE_FB32(i64 %6, i64 %13)
%15 = add i64 %6, 4
%16 = load i64, i64* %7
%17 = shl i64 %16, 16
%18 = load i64, i64* %10
%19 = and i64 %18, 65535
%20 = or i64 %19, %17
%21 = tail call i32 @WRITE_FB32(i64 %15, i64 %20)
%22 = add i64 %6, 8
%23 = add nuw nsw i64 %5, 1
%24 = icmp eq i64 %23, 32
br i1 %24, label %25, label %4
25: ; preds = %4
ret void
}