#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*/ RamWrite32A(int, unsigned long);
void MesFil(unsigned char UcMesMod) {
  unsigned long UlMeasFilaA, UlMeasFilaB, UlMeasFilaC;
  unsigned long UlMeasFilbA, UlMeasFilbB, UlMeasFilbC;
  if (!UcMesMod) {
    UlMeasFilaA = 0x02F19B01;
    UlMeasFilaB = 0x02F19B01;
    UlMeasFilaC = 0x7A1CC9FF;
    UlMeasFilbA = 0x7FFFFFFF;
    UlMeasFilbB = 0x00000000;
    UlMeasFilbC = 0x00000000;
  } else if (UcMesMod == 1) {
    UlMeasFilaA = 0x115CC757;
    UlMeasFilaB = 0x115CC757;
    UlMeasFilaC = 0x5D467153;
    UlMeasFilbA = 0x7F667431;
    UlMeasFilbB = 0x80998BCF;
    UlMeasFilbC = 0x7ECCE863;
  } else if (UcMesMod == 2) {
    UlMeasFilaA = 0x7FFFFFFF;
    UlMeasFilaB = 0x00000000;
    UlMeasFilaC = 0x00000000;
    UlMeasFilbA = 0x7FFFFFFF;
    UlMeasFilbB = 0x00000000;
    UlMeasFilbC = 0x00000000;
  } else if (UcMesMod == 3) {
    UlMeasFilaA = 0x02F19B01;
    UlMeasFilaB = 0x02F19B01;
    UlMeasFilaC = 0x7A1CC9FF;
    UlMeasFilbA = 0x02F19B01;
    UlMeasFilbB = 0x02F19B01;
    UlMeasFilbC = 0x7A1CC9FF;
  } else if (UcMesMod == 4) {
    UlMeasFilaA = 0x05C141BB;
    UlMeasFilaB = 0x05C141BB;
    UlMeasFilaC = 0x747D7C88;
    UlMeasFilbA = 0x05C141BB;
    UlMeasFilbB = 0x05C141BB;
    UlMeasFilbC = 0x747D7C88;
  }
  RamWrite32A(0x0004 + 0x0004 + 0x0000 + 0x80a4, UlMeasFilaA);
  RamWrite32A(0x0000 + 0x80a4, UlMeasFilaB);
  RamWrite32A(0x0004 + 0x0000 + 0x80a4, UlMeasFilaC);
  RamWrite32A(0x0004 + 0x0004 + 0x0004 + 0x0004 + 0x0004 + 0x0000 + 0x80a4,
              UlMeasFilbA);
  RamWrite32A(0x0004 + 0x0004 + 0x0004 + 0x0000 + 0x80a4, UlMeasFilbB);
  RamWrite32A(0x0004 + 0x0004 + 0x0004 + 0x0004 + 0x0000 + 0x80a4, UlMeasFilbC);
  RamWrite32A(0x0004 + 0x0004 + 0x0000 + 0x80bc, UlMeasFilaA);
  RamWrite32A(0x0000 + 0x80bc, UlMeasFilaB);
  RamWrite32A(0x0004 + 0x0000 + 0x80bc, UlMeasFilaC);
  RamWrite32A(0x0004 + 0x0004 + 0x0004 + 0x0004 + 0x0004 + 0x0000 + 0x80bc,
              UlMeasFilbA);
  RamWrite32A(0x0004 + 0x0004 + 0x0004 + 0x0000 + 0x80bc, UlMeasFilbB);
  RamWrite32A(0x0004 + 0x0004 + 0x0004 + 0x0004 + 0x0000 + 0x80bc, UlMeasFilbC);
}


x86 assembly (clang, -O0):
<MesFil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
jne    115d <MesFil+0x4d>
movq   $0x2f19b01,-0x10(%rbp)
02
movq   $0x2f19b01,-0x18(%rbp)
02
movq   $0x7a1cc9ff,-0x20(%rbp)
7a
movq   $0x7fffffff,-0x28(%rbp)
7f
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
jmp    1275 <MesFil+0x165>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    11a0 <MesFil+0x90>
movq   $0x115cc757,-0x10(%rbp)
11
movq   $0x115cc757,-0x18(%rbp)
11
movq   $0x5d467153,-0x20(%rbp)
5d
movq   $0x7f667431,-0x28(%rbp)
7f
mov    $0x80998bcf,%eax
mov    %rax,-0x30(%rbp)
movq   $0x7ecce863,-0x38(%rbp)
7e
jmp    1270 <MesFil+0x160>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    11e2 <MesFil+0xd2>
movq   $0x7fffffff,-0x10(%rbp)
7f
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x7fffffff,-0x28(%rbp)
7f
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
jmp    126b <MesFil+0x15b>
movzbl -0x1(%rbp),%eax
cmp    $0x3,%eax
jne    1224 <MesFil+0x114>
movq   $0x2f19b01,-0x10(%rbp)
02
movq   $0x2f19b01,-0x18(%rbp)
02
movq   $0x7a1cc9ff,-0x20(%rbp)
7a
movq   $0x2f19b01,-0x28(%rbp)
02
movq   $0x2f19b01,-0x30(%rbp)
02
movq   $0x7a1cc9ff,-0x38(%rbp)
7a
jmp    1266 <MesFil+0x156>
movzbl -0x1(%rbp),%eax
cmp    $0x4,%eax
jne    1261 <MesFil+0x151>
movq   $0x5c141bb,-0x10(%rbp)
05
movq   $0x5c141bb,-0x18(%rbp)
05
movq   $0x747d7c88,-0x20(%rbp)
74
movq   $0x5c141bb,-0x28(%rbp)
05
movq   $0x5c141bb,-0x30(%rbp)
05
movq   $0x747d7c88,-0x38(%rbp)
74
jmp    1266 <MesFil+0x156>
jmp    126b <MesFil+0x15b>
jmp    1270 <MesFil+0x160>
jmp    1275 <MesFil+0x165>
mov    -0x10(%rbp),%rsi
mov    $0x80ac,%edi
call   1030 <RamWrite32A@plt>
mov    -0x18(%rbp),%rsi
mov    $0x80a4,%edi
call   1030 <RamWrite32A@plt>
mov    -0x20(%rbp),%rsi
mov    $0x80a8,%edi
call   1030 <RamWrite32A@plt>
mov    -0x28(%rbp),%rsi
mov    $0x80b8,%edi
call   1030 <RamWrite32A@plt>
mov    -0x30(%rbp),%rsi
mov    $0x80b0,%edi
call   1030 <RamWrite32A@plt>
mov    -0x38(%rbp),%rsi
mov    $0x80b4,%edi
call   1030 <RamWrite32A@plt>
mov    -0x10(%rbp),%rsi
mov    $0x80c4,%edi
call   1030 <RamWrite32A@plt>
mov    -0x18(%rbp),%rsi
mov    $0x80bc,%edi
call   1030 <RamWrite32A@plt>
mov    -0x20(%rbp),%rsi
mov    $0x80c0,%edi
call   1030 <RamWrite32A@plt>
mov    -0x28(%rbp),%rsi
mov    $0x80d0,%edi
call   1030 <RamWrite32A@plt>
mov    -0x30(%rbp),%rsi
mov    $0x80c8,%edi
call   1030 <RamWrite32A@plt>
mov    -0x38(%rbp),%rsi
mov    $0x80cc,%edi
call   1030 <RamWrite32A@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MesFil>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
add    $0xff,%dil
cmp    $0x3,%dil
ja     116d <MesFil+0x5d>
movsbq %dil,%rax
lea    0xed0(%rip),%rcx
mov    (%rcx,%rax,8),%rbx
lea    0xee5(%rip),%rcx
mov    (%rcx,%rax,8),%rbp
lea    0xefa(%rip),%rcx
mov    (%rcx,%rax,8),%r13
lea    0xf0f(%rip),%rcx
mov    (%rcx,%rax,8),%r15
lea    0xf24(%rip),%rcx
mov    (%rcx,%rax,8),%r14
lea    0xf39(%rip),%rcx
mov    (%rcx,%rax,8),%r12
jmp    1189 <MesFil+0x79>
mov    $0x7fffffff,%r15d
mov    $0x7a1cc9ff,%r13d
mov    $0x2f19b01,%ebx
xor    %r14d,%r14d
mov    $0x2f19b01,%ebp
xor    %r12d,%r12d
mov    $0x80ac,%edi
mov    %rbx,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80a4,%edi
mov    %rbp,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80a8,%edi
mov    %r13,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80b8,%edi
mov    %r15,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80b0,%edi
mov    %r14,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80b4,%edi
mov    %r12,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80c4,%edi
mov    %rbx,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80bc,%edi
mov    %rbp,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80c0,%edi
mov    %r13,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80d0,%edi
mov    %r15,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80c8,%edi
mov    %r14,%rsi
call   1030 <RamWrite32A@plt>
mov    $0x80cc,%edi
mov    %r12,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <RamWrite32A@plt>

LLVM IR (-O0):
define void @MesFil(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i8 %0, i8* %2
%9 = load i8, i8* %2
%10 = icmp ne i8 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %1
store i64 49388289, i64* %3
store i64 49388289, i64* %4
store i64 2048707071, i64* %5
store i64 2147483647, i64* %6
store i64 0, i64* %7
store i64 0, i64* %8
br label %36
12: ; preds = %1
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %12
store i64 291293015, i64* %3
store i64 291293015, i64* %4
store i64 1564897619, i64* %5
store i64 2137420849, i64* %6
store i64 2157546447, i64* %7
store i64 2127358051, i64* %8
br label %35
17: ; preds = %12
%18 = load i8, i8* %2
%19 = zext i8 %18 to i32
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %22
21: ; preds = %17
store i64 2147483647, i64* %3
store i64 0, i64* %4
store i64 0, i64* %5
store i64 2147483647, i64* %6
store i64 0, i64* %7
store i64 0, i64* %8
br label %34
22: ; preds = %17
%23 = load i8, i8* %2
%24 = zext i8 %23 to i32
%25 = icmp eq i32 %24, 3
br i1 %25, label %26, label %27
26: ; preds = %22
store i64 49388289, i64* %3
store i64 49388289, i64* %4
store i64 2048707071, i64* %5
store i64 49388289, i64* %6
store i64 49388289, i64* %7
store i64 2048707071, i64* %8
br label %33
27: ; preds = %22
%28 = load i8, i8* %2
%29 = zext i8 %28 to i32
%30 = icmp eq i32 %29, 4
br i1 %30, label %31, label %32
31: ; preds = %27
store i64 96551355, i64* %3
store i64 96551355, i64* %4
store i64 1954380936, i64* %5
store i64 96551355, i64* %6
store i64 96551355, i64* %7
store i64 1954380936, i64* %8
br label %32
32: ; preds = %31, %27
br label %33
33: ; preds = %32, %26
br label %34
34: ; preds = %33, %21
br label %35
35: ; preds = %34, %16
br label %36
36: ; preds = %35, %11
%37 = load i64, i64* %3
%38 = call i32 @RamWrite32A(i32 32940, i64 %37)
%39 = load i64, i64* %4
%40 = call i32 @RamWrite32A(i32 32932, i64 %39)
%41 = load i64, i64* %5
%42 = call i32 @RamWrite32A(i32 32936, i64 %41)
%43 = load i64, i64* %6
%44 = call i32 @RamWrite32A(i32 32952, i64 %43)
%45 = load i64, i64* %7
%46 = call i32 @RamWrite32A(i32 32944, i64 %45)
%47 = load i64, i64* %8
%48 = call i32 @RamWrite32A(i32 32948, i64 %47)
%49 = load i64, i64* %3
%50 = call i32 @RamWrite32A(i32 32964, i64 %49)
%51 = load i64, i64* %4
%52 = call i32 @RamWrite32A(i32 32956, i64 %51)
%53 = load i64, i64* %5
%54 = call i32 @RamWrite32A(i32 32960, i64 %53)
%55 = load i64, i64* %6
%56 = call i32 @RamWrite32A(i32 32976, i64 %55)
%57 = load i64, i64* %7
%58 = call i32 @RamWrite32A(i32 32968, i64 %57)
%59 = load i64, i64* %8
%60 = call i32 @RamWrite32A(i32 32972, i64 %59)
ret void
}

LLVM IR (-O2):
@switch.table.MesFil = [4 x i64] [i64 291293015, i64 2147483647, i64 49388289, i64 96551355]
@switch.table.MesFil.1 = [4 x i64] [i64 291293015, i64 0, i64 49388289, i64 96551355]
@switch.table.MesFil.2 = [4 x i64] [i64 1564897619, i64 0, i64 2048707071, i64 1954380936]
@switch.table.MesFil.3 = [4 x i64] [i64 2137420849, i64 2147483647, i64 49388289, i64 96551355]
@switch.table.MesFil.4 = [4 x i64] [i64 2157546447, i64 0, i64 49388289, i64 96551355]
@switch.table.MesFil.5 = [4 x i64] [i64 2127358051, i64 0, i64 2048707071, i64 1954380936]
define void @MesFil(i8 zeroext %0) {
%2 = add i8 %0, -1
%3 = icmp ult i8 %2, 4
br i1 %3, label %4, label %23
4: ; preds = %1
%5 = sext i8 %2 to i64
%6 = getelementptr inbounds [4 x i64], [4 x i64]* @switch.table.MesFil, i64 0, i64 %5
%7 = load i64, i64* %6
%8 = sext i8 %2 to i64
%9 = getelementptr inbounds [4 x i64], [4 x i64]* @switch.table.MesFil.1, i64 0, i64 %8
%10 = load i64, i64* %9
%11 = sext i8 %2 to i64
%12 = getelementptr inbounds [4 x i64], [4 x i64]* @switch.table.MesFil.2, i64 0, i64 %11
%13 = load i64, i64* %12
%14 = sext i8 %2 to i64
%15 = getelementptr inbounds [4 x i64], [4 x i64]* @switch.table.MesFil.3, i64 0, i64 %14
%16 = load i64, i64* %15
%17 = sext i8 %2 to i64
%18 = getelementptr inbounds [4 x i64], [4 x i64]* @switch.table.MesFil.4, i64 0, i64 %17
%19 = load i64, i64* %18
%20 = sext i8 %2 to i64
%21 = getelementptr inbounds [4 x i64], [4 x i64]* @switch.table.MesFil.5, i64 0, i64 %20
%22 = load i64, i64* %21
br label %23
23: ; preds = %4, %1
%24 = phi i64 [ 49388289, %1 ], [ %7, %4 ]
%25 = phi i64 [ 49388289, %1 ], [ %10, %4 ]
%26 = phi i64 [ 2048707071, %1 ], [ %13, %4 ]
%27 = phi i64 [ 2147483647, %1 ], [ %16, %4 ]
%28 = phi i64 [ 0, %1 ], [ %19, %4 ]
%29 = phi i64 [ 0, %1 ], [ %22, %4 ]
%30 = tail call i32 @RamWrite32A(i32 32940, i64 %24)
%31 = tail call i32 @RamWrite32A(i32 32932, i64 %25)
%32 = tail call i32 @RamWrite32A(i32 32936, i64 %26)
%33 = tail call i32 @RamWrite32A(i32 32952, i64 %27)
%34 = tail call i32 @RamWrite32A(i32 32944, i64 %28)
%35 = tail call i32 @RamWrite32A(i32 32948, i64 %29)
%36 = tail call i32 @RamWrite32A(i32 32964, i64 %24)
%37 = tail call i32 @RamWrite32A(i32 32956, i64 %25)
%38 = tail call i32 @RamWrite32A(i32 32960, i64 %26)
%39 = tail call i32 @RamWrite32A(i32 32976, i64 %27)
%40 = tail call i32 @RamWrite32A(i32 32968, i64 %28)
%41 = tail call i32 @RamWrite32A(i32 32972, i64 %29)
ret void
}