#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 */
scalar_t__ ASIC_GetCartPage(int);
void ASIC_RefreshExpansionROMTable(unsigned char **pExpansionROMTable) {
  int i;
  unsigned char *pExpansionROM;
  for (i = 128; i < 256; i++) {
    pExpansionROM =
        (unsigned char *)((unsigned long)ASIC_GetCartPage(i & 0x01f) -
                          (unsigned long)0x0c000);
    pExpansionROMTable[i] = pExpansionROM;
  }
  pExpansionROM = (unsigned char *)((unsigned long)ASIC_GetCartPage(1) -
                                    (unsigned long)0x0c000);
  for (i = 0; i < 128; i++) {
    pExpansionROMTable[i] = pExpansionROM;
  }
  pExpansionROM = (unsigned char *)((unsigned long)ASIC_GetCartPage(3) -
                                    (unsigned long)0x0c000);
  pExpansionROMTable[7] = pExpansionROM;
}


x86 assembly (clang, -O0):
<ASIC_RefreshExpansionROMTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x80,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    1163 <ASIC_RefreshExpansionROMTable+0x53>
mov    -0xc(%rbp),%edi
and    $0x1f,%edi
call   1030 <ASIC_GetCartPage@plt>
sub    $0xc000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <ASIC_RefreshExpansionROMTable+0x13>
mov    $0x1,%edi
call   1030 <ASIC_GetCartPage@plt>
sub    $0xc000,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x80,-0xc(%rbp)
jge    11a9 <ASIC_RefreshExpansionROMTable+0x99>
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117e <ASIC_RefreshExpansionROMTable+0x6e>
mov    $0x3,%edi
call   1030 <ASIC_GetCartPage@plt>
sub    $0xc000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x38(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASIC_RefreshExpansionROMTable>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x80,%ebx
nopl   0x0(%rax)
mov    %ebx,%edi
and    $0x1f,%edi
call   1030 <ASIC_GetCartPage@plt>
add    $0xffffffffffff4000,%rax
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1120 <ASIC_RefreshExpansionROMTable+0x10>
mov    $0x1,%edi
call   1030 <ASIC_GetCartPage@plt>
add    $0xffffffffffff4000,%rax
movq   %rax,%xmm0
pshufd $0x44,%xmm0,%xmm0
movdqu %xmm0,(%r14)
movdqu %xmm0,0x10(%r14)
movdqu %xmm0,0x20(%r14)
movdqu %xmm0,0x30(%r14)
movdqu %xmm0,0x40(%r14)
movdqu %xmm0,0x50(%r14)
movdqu %xmm0,0x60(%r14)
movdqu %xmm0,0x70(%r14)
movdqu %xmm0,0x80(%r14)
movdqu %xmm0,0x90(%r14)
movdqu %xmm0,0xa0(%r14)
movdqu %xmm0,0xb0(%r14)
movdqu %xmm0,0xc0(%r14)
movdqu %xmm0,0xd0(%r14)
movdqu %xmm0,0xe0(%r14)
movdqu %xmm0,0xf0(%r14)
movdqu %xmm0,0x100(%r14)
movdqu %xmm0,0x110(%r14)
movdqu %xmm0,0x120(%r14)
movdqu %xmm0,0x130(%r14)
movdqu %xmm0,0x140(%r14)
movdqu %xmm0,0x150(%r14)
movdqu %xmm0,0x160(%r14)
movdqu %xmm0,0x170(%r14)
movdqu %xmm0,0x180(%r14)
movdqu %xmm0,0x190(%r14)
movdqu %xmm0,0x1a0(%r14)
movdqu %xmm0,0x1b0(%r14)
movdqu %xmm0,0x1c0(%r14)
movdqu %xmm0,0x1d0(%r14)
movdqu %xmm0,0x1e0(%r14)
movdqu %xmm0,0x1f0(%r14)
movdqu %xmm0,0x200(%r14)
movdqu %xmm0,0x210(%r14)
movdqu %xmm0,0x220(%r14)
movdqu %xmm0,0x230(%r14)
movdqu %xmm0,0x240(%r14)
movdqu %xmm0,0x250(%r14)
movdqu %xmm0,0x260(%r14)
movdqu %xmm0,0x270(%r14)
movdqu %xmm0,0x280(%r14)
movdqu %xmm0,0x290(%r14)
movdqu %xmm0,0x2a0(%r14)
movdqu %xmm0,0x2b0(%r14)
movdqu %xmm0,0x2c0(%r14)
movdqu %xmm0,0x2d0(%r14)
movdqu %xmm0,0x2e0(%r14)
movdqu %xmm0,0x2f0(%r14)
movdqu %xmm0,0x300(%r14)
movdqu %xmm0,0x310(%r14)
movdqu %xmm0,0x320(%r14)
movdqu %xmm0,0x330(%r14)
movdqu %xmm0,0x340(%r14)
movdqu %xmm0,0x350(%r14)
movdqu %xmm0,0x360(%r14)
movdqu %xmm0,0x370(%r14)
movdqu %xmm0,0x380(%r14)
movdqu %xmm0,0x390(%r14)
movdqu %xmm0,0x3a0(%r14)
movdqu %xmm0,0x3b0(%r14)
movdqu %xmm0,0x3c0(%r14)
movdqu %xmm0,0x3d0(%r14)
movdqu %xmm0,0x3e0(%r14)
movdqu %xmm0,0x3f0(%r14)
mov    $0x3,%edi
call   1030 <ASIC_GetCartPage@plt>
add    $0xffffffffffff4000,%rax
mov    %rax,0x38(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ASIC_RefreshExpansionROMTable(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i8*
store i8** %0, i8*** %2
store i32 128, i32* %3
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 256
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %3
%10 = and i32 %9, 31
%11 = call i64 @ASIC_GetCartPage(i32 %10)
%12 = sub i64 %11, 49152
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = load i8**, i8*** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
store i8* %14, i8** %18
br label %19
19: ; preds = %8
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %5
22: ; preds = %5
%23 = call i64 @ASIC_GetCartPage(i32 1)
%24 = sub i64 %23, 49152
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %4
store i32 0, i32* %3
br label %26
26: ; preds = %35, %22
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 128
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = load i8*, i8** %4
%31 = load i8**, i8*** %2
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
store i8* %30, i8** %34
br label %35
35: ; preds = %29
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %26
38: ; preds = %26
%39 = call i64 @ASIC_GetCartPage(i32 3)
%40 = sub i64 %39, 49152
%41 = inttoptr i64 %40 to i8*
store i8* %41, i8** %4
%42 = load i8*, i8** %4
%43 = load i8**, i8*** %2
%44 = getelementptr inbounds i8*, i8** %43, i64 7
store i8* %42, i8** %44
ret void
}

LLVM IR (-O2):
define void @ASIC_RefreshExpansionROMTable(i8** nocapture writeonly %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 128, %1 ], [ %10, %2 ]
%4 = trunc i64 %3 to i32
%5 = and i32 %4, 31
%6 = tail call i64 @ASIC_GetCartPage(i32 %5)
%7 = add i64 %6, -49152
%8 = inttoptr i64 %7 to i8*
%9 = getelementptr inbounds i8*, i8** %0, i64 %3
store i8* %8, i8** %9
%10 = add nuw nsw i64 %3, 1
%11 = icmp eq i64 %10, 256
br i1 %11, label %12, label %2
12: ; preds = %2
%13 = tail call i64 @ASIC_GetCartPage(i32 1)
%14 = add i64 %13, -49152
%15 = inttoptr i64 %14 to i8*
%16 = insertelement <2 x i8*> poison, i8* %15, i64 0
%17 = shufflevector <2 x i8*> %16, <2 x i8*> poison, <2 x i32> zeroinitializer
%18 = insertelement <2 x i8*> poison, i8* %15, i64 0
%19 = shufflevector <2 x i8*> %18, <2 x i8*> poison, <2 x i32> zeroinitializer
%20 = bitcast i8** %0 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %20
%21 = getelementptr inbounds i8*, i8** %0, i64 2
%22 = bitcast i8** %21 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %22
%23 = getelementptr inbounds i8*, i8** %0, i64 4
%24 = bitcast i8** %23 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %24
%25 = getelementptr inbounds i8*, i8** %0, i64 6
%26 = bitcast i8** %25 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %26
%27 = getelementptr inbounds i8*, i8** %0, i64 8
%28 = bitcast i8** %27 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %28
%29 = getelementptr inbounds i8*, i8** %0, i64 10
%30 = bitcast i8** %29 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %30
%31 = getelementptr inbounds i8*, i8** %0, i64 12
%32 = bitcast i8** %31 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %32
%33 = getelementptr inbounds i8*, i8** %0, i64 14
%34 = bitcast i8** %33 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %34
%35 = getelementptr inbounds i8*, i8** %0, i64 16
%36 = bitcast i8** %35 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %36
%37 = getelementptr inbounds i8*, i8** %0, i64 18
%38 = bitcast i8** %37 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %38
%39 = getelementptr inbounds i8*, i8** %0, i64 20
%40 = bitcast i8** %39 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %40
%41 = getelementptr inbounds i8*, i8** %0, i64 22
%42 = bitcast i8** %41 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %42
%43 = getelementptr inbounds i8*, i8** %0, i64 24
%44 = bitcast i8** %43 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %44
%45 = getelementptr inbounds i8*, i8** %0, i64 26
%46 = bitcast i8** %45 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %46
%47 = getelementptr inbounds i8*, i8** %0, i64 28
%48 = bitcast i8** %47 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %48
%49 = getelementptr inbounds i8*, i8** %0, i64 30
%50 = bitcast i8** %49 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %50
%51 = getelementptr inbounds i8*, i8** %0, i64 32
%52 = bitcast i8** %51 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %52
%53 = getelementptr inbounds i8*, i8** %0, i64 34
%54 = bitcast i8** %53 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %54
%55 = getelementptr inbounds i8*, i8** %0, i64 36
%56 = bitcast i8** %55 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %56
%57 = getelementptr inbounds i8*, i8** %0, i64 38
%58 = bitcast i8** %57 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %58
%59 = getelementptr inbounds i8*, i8** %0, i64 40
%60 = bitcast i8** %59 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %60
%61 = getelementptr inbounds i8*, i8** %0, i64 42
%62 = bitcast i8** %61 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %62
%63 = getelementptr inbounds i8*, i8** %0, i64 44
%64 = bitcast i8** %63 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %64
%65 = getelementptr inbounds i8*, i8** %0, i64 46
%66 = bitcast i8** %65 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %66
%67 = getelementptr inbounds i8*, i8** %0, i64 48
%68 = bitcast i8** %67 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %68
%69 = getelementptr inbounds i8*, i8** %0, i64 50
%70 = bitcast i8** %69 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %70
%71 = getelementptr inbounds i8*, i8** %0, i64 52
%72 = bitcast i8** %71 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %72
%73 = getelementptr inbounds i8*, i8** %0, i64 54
%74 = bitcast i8** %73 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %74
%75 = getelementptr inbounds i8*, i8** %0, i64 56
%76 = bitcast i8** %75 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %76
%77 = getelementptr inbounds i8*, i8** %0, i64 58
%78 = bitcast i8** %77 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %78
%79 = getelementptr inbounds i8*, i8** %0, i64 60
%80 = bitcast i8** %79 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %80
%81 = getelementptr inbounds i8*, i8** %0, i64 62
%82 = bitcast i8** %81 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %82
%83 = getelementptr inbounds i8*, i8** %0, i64 64
%84 = bitcast i8** %83 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %84
%85 = getelementptr inbounds i8*, i8** %0, i64 66
%86 = bitcast i8** %85 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %86
%87 = getelementptr inbounds i8*, i8** %0, i64 68
%88 = bitcast i8** %87 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %88
%89 = getelementptr inbounds i8*, i8** %0, i64 70
%90 = bitcast i8** %89 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %90
%91 = getelementptr inbounds i8*, i8** %0, i64 72
%92 = bitcast i8** %91 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %92
%93 = getelementptr inbounds i8*, i8** %0, i64 74
%94 = bitcast i8** %93 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %94
%95 = getelementptr inbounds i8*, i8** %0, i64 76
%96 = bitcast i8** %95 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %96
%97 = getelementptr inbounds i8*, i8** %0, i64 78
%98 = bitcast i8** %97 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %98
%99 = getelementptr inbounds i8*, i8** %0, i64 80
%100 = bitcast i8** %99 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %100
%101 = getelementptr inbounds i8*, i8** %0, i64 82
%102 = bitcast i8** %101 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %102
%103 = getelementptr inbounds i8*, i8** %0, i64 84
%104 = bitcast i8** %103 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %104
%105 = getelementptr inbounds i8*, i8** %0, i64 86
%106 = bitcast i8** %105 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %106
%107 = getelementptr inbounds i8*, i8** %0, i64 88
%108 = bitcast i8** %107 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %108
%109 = getelementptr inbounds i8*, i8** %0, i64 90
%110 = bitcast i8** %109 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %110
%111 = getelementptr inbounds i8*, i8** %0, i64 92
%112 = bitcast i8** %111 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %112
%113 = getelementptr inbounds i8*, i8** %0, i64 94
%114 = bitcast i8** %113 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %114
%115 = getelementptr inbounds i8*, i8** %0, i64 96
%116 = bitcast i8** %115 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %116
%117 = getelementptr inbounds i8*, i8** %0, i64 98
%118 = bitcast i8** %117 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %118
%119 = getelementptr inbounds i8*, i8** %0, i64 100
%120 = bitcast i8** %119 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %120
%121 = getelementptr inbounds i8*, i8** %0, i64 102
%122 = bitcast i8** %121 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %122
%123 = getelementptr inbounds i8*, i8** %0, i64 104
%124 = bitcast i8** %123 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %124
%125 = getelementptr inbounds i8*, i8** %0, i64 106
%126 = bitcast i8** %125 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %126
%127 = getelementptr inbounds i8*, i8** %0, i64 108
%128 = bitcast i8** %127 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %128
%129 = getelementptr inbounds i8*, i8** %0, i64 110
%130 = bitcast i8** %129 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %130
%131 = getelementptr inbounds i8*, i8** %0, i64 112
%132 = bitcast i8** %131 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %132
%133 = getelementptr inbounds i8*, i8** %0, i64 114
%134 = bitcast i8** %133 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %134
%135 = getelementptr inbounds i8*, i8** %0, i64 116
%136 = bitcast i8** %135 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %136
%137 = getelementptr inbounds i8*, i8** %0, i64 118
%138 = bitcast i8** %137 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %138
%139 = getelementptr inbounds i8*, i8** %0, i64 120
%140 = bitcast i8** %139 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %140
%141 = getelementptr inbounds i8*, i8** %0, i64 122
%142 = bitcast i8** %141 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %142
%143 = getelementptr inbounds i8*, i8** %0, i64 124
%144 = bitcast i8** %143 to <2 x i8*>*
store <2 x i8*> %17, <2 x i8*>* %144
%145 = getelementptr inbounds i8*, i8** %0, i64 126
%146 = bitcast i8** %145 to <2 x i8*>*
store <2 x i8*> %19, <2 x i8*>* %146
%147 = tail call i64 @ASIC_GetCartPage(i32 3)
%148 = add i64 %147, -49152
%149 = inttoptr i64 %148 to i8*
%150 = getelementptr inbounds i8*, i8** %0, i64 7
store i8* %149, i8** %150
ret void
}