#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 uint32_t;

/* Variables and functions */
void disp_set_palette() {
  uint32_t palette_pb[16] = {0x00fc0000, 0x0346de7f, 0x036dcba1, 0x031a66ea,
                             0x03a42280, 0x03604377, 0x03cf9a16, 0x0393b94b,
                             0x00000000, 0x03000000, 0x03190000, 0x033a0000,
                             0x03750000, 0x039c0000, 0x03c30000, 0x03eb0000};
  for (uint32_t i = 0; i < 16; i++) {
    (*(volatile uint32_t *)(0xC0F14080 + i * 4)) = palette_pb[i];
  }
  (*(volatile uint32_t *)(0xC0F14078)) = 1;
}


x86 assembly (clang, -O0):
<disp_set_palette>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xedd(%rip),%rsi
mov    $0x40,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x10,-0x44(%rbp)
jge    1163 <disp_set_palette+0x53>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
mov    -0x44(%rbp),%eax
shl    $0x2,%eax
add    $0xc0f14080,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1134 <disp_set_palette+0x24>
mov    $0xc0f14078,%eax
movl   $0x1,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disp_set_palette>:
mov    $0xc0f14078,%eax
movl   $0xfc0000,0x8(%rax)
movl   $0x346de7f,0xc(%rax)
movl   $0x36dcba1,0x10(%rax)
movl   $0x31a66ea,0x14(%rax)
movl   $0x3a42280,0x18(%rax)
movl   $0x3604377,0x1c(%rax)
movl   $0x3cf9a16,0x20(%rax)
movl   $0x393b94b,0x24(%rax)
movl   $0x0,0x28(%rax)
movl   $0x3000000,0x2c(%rax)
movl   $0x3190000,0x30(%rax)
movl   $0x33a0000,0x34(%rax)
movl   $0x3750000,0x38(%rax)
movl   $0x39c0000,0x3c(%rax)
movl   $0x3c30000,0x40(%rax)
movl   $0x3eb0000,0x44(%rax)
movl   $0x1,(%rax)
ret

LLVM IR (-O0):
@__const.disp_set_palette.palette_pb = [16 x i32] [i32 16515072, i32 54976127, i32 57527201, i32 52061930, i32 61088384, i32 56640375, i32 63937046, i32 60012875, i32 0, i32 50331648, i32 51970048, i32 54132736, i32 57999360, i32 60555264, i32 63111168, i32 65732608]
define void @disp_set_palette() {
%1 = alloca [16 x i32]
%2 = alloca i32
%3 = bitcast [16 x i32]* %1 to i8*
store i32 0, i32* %2
br label %4
4: ; preds = %17, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 16
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = load i32, i32* %2
%13 = mul nsw i32 %12, 4
%14 = add i32 -1057931136, %13
%15 = zext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
store volatile i32 %11, i32* %16
br label %17
17: ; preds = %7
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %4
20: ; preds = %4
store volatile i32 1, i32* inttoptr (i64 3237036152 to i32*)
ret void
}

LLVM IR (-O2):
define void @disp_set_palette() {
store volatile i32 16515072, i32* inttoptr (i64 3237036160 to i32*)
store volatile i32 54976127, i32* inttoptr (i64 3237036164 to i32*)
store volatile i32 57527201, i32* inttoptr (i64 3237036168 to i32*)
store volatile i32 52061930, i32* inttoptr (i64 3237036172 to i32*)
store volatile i32 61088384, i32* inttoptr (i64 3237036176 to i32*)
store volatile i32 56640375, i32* inttoptr (i64 3237036180 to i32*)
store volatile i32 63937046, i32* inttoptr (i64 3237036184 to i32*)
store volatile i32 60012875, i32* inttoptr (i64 3237036188 to i32*)
store volatile i32 0, i32* inttoptr (i64 3237036192 to i32*)
store volatile i32 50331648, i32* inttoptr (i64 3237036196 to i32*)
store volatile i32 51970048, i32* inttoptr (i64 3237036200 to i32*)
store volatile i32 54132736, i32* inttoptr (i64 3237036204 to i32*)
store volatile i32 57999360, i32* inttoptr (i64 3237036208 to i32*)
store volatile i32 60555264, i32* inttoptr (i64 3237036212 to i32*)
store volatile i32 63111168, i32* inttoptr (i64 3237036216 to i32*)
store volatile i32 65732608, i32* inttoptr (i64 3237036220 to i32*)
store volatile i32 1, i32* inttoptr (i64 3237036152 to i32*)
ret void
}