#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*/ Inst_Printf(char *, char *, char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int Call_C_Arg_Mem_L(int offset, int adr_of, char *name, int index) {
  char dest[8];
  switch (offset) {
  case 0:
    sprintf(dest, "%s", "$4");
    break;
  case 1:
    sprintf(dest, "%s", "$5");
    break;
  case 2:
    sprintf(dest, "%s", "$6");
    break;
  case 3:
    sprintf(dest, "%s", "$7");
    break;
  case 4:
    sprintf(dest, "%s", "$8");
    break;
  case 5:
    sprintf(dest, "%s", "$9");
    break;
  case 6:
    sprintf(dest, "%s", "$10");
    break;
  case 7:
    sprintf(dest, "%s", "$11");
    break;
  default:
    sprintf(dest, "%s", "$24");
    break;
  }
  if (!adr_of) {
    Inst_Printf("la", "$25,%s", name);
    Inst_Printf("lw", "%s,%d($25)", dest, index * 4);
  } else {
    Inst_Printf("la", "%s,%s+%d", dest, name, index * 4);
  }
  if (offset > 7) {
    Inst_Printf("sw", "%s,%d($sp)", dest, (offset - 8) * 8 + 4);
  }
  return 1;
}


x86 assembly (clang, -O0):
<Call_C_Arg_Mem_L>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0x7,%rax
ja     123a <Call_C_Arg_Mem_L+0x11a>
mov    -0x28(%rbp),%rax
lea    0xeaf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x1c(%rbp),%rdi
lea    0xee0(%rip),%rsi
lea    0xeb4(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1251 <Call_C_Arg_Mem_L+0x131>
lea    -0x1c(%rbp),%rdi
lea    0xec4(%rip),%rsi
lea    0xe9b(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1251 <Call_C_Arg_Mem_L+0x131>
lea    -0x1c(%rbp),%rdi
lea    0xea8(%rip),%rsi
lea    0xe82(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1251 <Call_C_Arg_Mem_L+0x131>
lea    -0x1c(%rbp),%rdi
lea    0xe8c(%rip),%rsi
lea    0xe69(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1251 <Call_C_Arg_Mem_L+0x131>
lea    -0x1c(%rbp),%rdi
lea    0xe70(%rip),%rsi
lea    0xe50(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1251 <Call_C_Arg_Mem_L+0x131>
lea    -0x1c(%rbp),%rdi
lea    0xe54(%rip),%rsi
lea    0xe37(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1251 <Call_C_Arg_Mem_L+0x131>
lea    -0x1c(%rbp),%rdi
lea    0xe38(%rip),%rsi
lea    0xe1e(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1251 <Call_C_Arg_Mem_L+0x131>
lea    -0x1c(%rbp),%rdi
lea    0xe1c(%rip),%rsi
lea    0xe06(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1251 <Call_C_Arg_Mem_L+0x131>
lea    -0x1c(%rbp),%rdi
lea    0xe00(%rip),%rsi
lea    0xdee(%rip),%rdx
call   1040 <sprintf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1298 <Call_C_Arg_Mem_L+0x178>
mov    -0x10(%rbp),%rdx
lea    0xdd8(%rip),%rdi
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
lea    -0x1c(%rbp),%rdx
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
lea    0xdc3(%rip),%rdi
lea    0xdbf(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
jmp    12bd <Call_C_Arg_Mem_L+0x19d>
lea    -0x1c(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
shl    $0x2,%r8d
lea    0xd8f(%rip),%rdi
lea    0xda0(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
cmpl   $0x7,-0x4(%rbp)
jle    12ec <Call_C_Arg_Mem_L+0x1cc>
lea    -0x1c(%rbp),%rdx
mov    -0x4(%rbp),%ecx
sub    $0x8,%ecx
shl    $0x3,%ecx
add    $0x4,%ecx
lea    0xd81(%rip),%rdi
lea    0xd7d(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Call_C_Arg_Mem_L>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rcx
mov    %edi,%ebx
cmp    $0x7,%edi
ja     1145 <Call_C_Arg_Mem_L+0x35>
mov    %ebx,%eax
lea    0xed8(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
movb   $0x0,0x2(%rsp)
movw   $0x3424,(%rsp)
test   %esi,%esi
jne    11be <Call_C_Arg_Mem_L+0xae>
jmp    1217 <Call_C_Arg_Mem_L+0x107>
movl   $0x343224,(%rsp)
test   %esi,%esi
jne    11be <Call_C_Arg_Mem_L+0xae>
jmp    1217 <Call_C_Arg_Mem_L+0x107>
movb   $0x0,0x2(%rsp)
movw   $0x3524,(%rsp)
test   %esi,%esi
jne    11be <Call_C_Arg_Mem_L+0xae>
jmp    1217 <Call_C_Arg_Mem_L+0x107>
movb   $0x0,0x2(%rsp)
movw   $0x3624,(%rsp)
test   %esi,%esi
jne    11be <Call_C_Arg_Mem_L+0xae>
jmp    1217 <Call_C_Arg_Mem_L+0x107>
movb   $0x0,0x2(%rsp)
movw   $0x3724,(%rsp)
test   %esi,%esi
jne    11be <Call_C_Arg_Mem_L+0xae>
jmp    1217 <Call_C_Arg_Mem_L+0x107>
movb   $0x0,0x2(%rsp)
movw   $0x3824,(%rsp)
test   %esi,%esi
jne    11be <Call_C_Arg_Mem_L+0xae>
jmp    1217 <Call_C_Arg_Mem_L+0x107>
movb   $0x0,0x2(%rsp)
movw   $0x3924,(%rsp)
test   %esi,%esi
jne    11be <Call_C_Arg_Mem_L+0xae>
jmp    1217 <Call_C_Arg_Mem_L+0x107>
movl   $0x303124,(%rsp)
test   %esi,%esi
je     1217 <Call_C_Arg_Mem_L+0x107>
shl    $0x2,%ebp
lea    0xe6a(%rip),%rdi
lea    0xe7b(%rip),%rsi
mov    %rsp,%rdx
mov    %ebp,%r8d
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
cmp    $0x8,%ebx
jl     1200 <Call_C_Arg_Mem_L+0xf0>
lea    -0x3c(,%rbx,8),%ecx
lea    0xe64(%rip),%rdi
lea    0xe60(%rip),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
movl   $0x313124,(%rsp)
test   %esi,%esi
jne    11be <Call_C_Arg_Mem_L+0xae>
lea    0xe14(%rip),%rdi
lea    0xe10(%rip),%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
shl    $0x2,%ebp
lea    0xe03(%rip),%rdi
lea    0xdff(%rip),%rsi
mov    %rsp,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
cmp    $0x8,%ebx
jge    11e1 <Call_C_Arg_Mem_L+0xd1>
jmp    1200 <Call_C_Arg_Mem_L+0xf0>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"$4\00"
@.str.2 = [3 x i8] c"$5\00"
@.str.3 = [3 x i8] c"$6\00"
@.str.4 = [3 x i8] c"$7\00"
@.str.5 = [3 x i8] c"$8\00"
@.str.6 = [3 x i8] c"$9\00"
@.str.7 = [4 x i8] c"$10\00"
@.str.8 = [4 x i8] c"$11\00"
@.str.9 = [4 x i8] c"$24\00"
@.str.10 = [3 x i8] c"la\00"
@.str.11 = [7 x i8] c"$25,%s\00"
@.str.12 = [3 x i8] c"lw\00"
@.str.13 = [11 x i8] c"%s,%d($25)\00"
@.str.14 = [9 x i8] c"%s,%s+%d\00"
@.str.15 = [3 x i8] c"sw\00"
@.str.16 = [11 x i8] c"%s,%d($sp)\00"
define i32 @Call_C_Arg_Mem_L(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [8 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
switch i32 %10, label %35 [
i32 0, label %11
i32 1, label %14
i32 2, label %17
i32 3, label %20
i32 4, label %23
i32 5, label %26
i32 6, label %29
i32 7, label %32
]
11: ; preds = %4
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%13 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %38
14: ; preds = %4
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%16 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %38
17: ; preds = %4
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%19 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %38
20: ; preds = %4
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%22 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %38
23: ; preds = %4
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%25 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %38
26: ; preds = %4
%27 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%28 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %38
29: ; preds = %4
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%31 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %38
32: ; preds = %4
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%34 = call i32 @sprintf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %38
35: ; preds = %4
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%37 = call i32 @sprintf(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %38
38: ; preds = %35, %32, %29, %26, %23, %20, %17, %14, %11
%39 = load i32, i32* %6
%40 = icmp ne i32 %39, 0
br i1 %40, label %48, label %41
41: ; preds = %38
%42 = load i8*, i8** %7
%43 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%45 = load i32, i32* %8
%46 = mul nsw i32 %45, 4
%47 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* %44, i32 %46)
br label %54
48: ; preds = %38
%49 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%50 = load i8*, i8** %7
%51 = load i32, i32* %8
%52 = mul nsw i32 %51, 4
%53 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8* %49, i8* %50, i32 %52)
br label %54
54: ; preds = %48, %41
%55 = load i32, i32* %5
%56 = icmp sgt i32 %55, 7
br i1 %56, label %57, label %64
57: ; preds = %54
%58 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%59 = load i32, i32* %5
%60 = sub nsw i32 %59, 8
%61 = mul nsw i32 %60, 8
%62 = add nsw i32 %61, 4
%63 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* %58, i32 %62)
br label %64
64: ; preds = %57, %54
ret i32 1
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"$4\00"
@.str.2 = [3 x i8] c"$5\00"
@.str.3 = [3 x i8] c"$6\00"
@.str.4 = [3 x i8] c"$7\00"
@.str.5 = [3 x i8] c"$8\00"
@.str.6 = [3 x i8] c"$9\00"
@.str.10 = [3 x i8] c"la\00"
@.str.11 = [7 x i8] c"$25,%s\00"
@.str.12 = [3 x i8] c"lw\00"
@.str.13 = [11 x i8] c"%s,%d($25)\00"
@.str.14 = [9 x i8] c"%s,%s+%d\00"
@.str.15 = [3 x i8] c"sw\00"
@.str.16 = [11 x i8] c"%s,%d($sp)\00"
define i32 @Call_C_Arg_Mem_L(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca [8 x i8]
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
switch i32 %0, label %17 [
i32 0, label %7
i32 1, label %8
i32 2, label %9
i32 3, label %10
i32 4, label %11
i32 5, label %12
i32 6, label %13
i32 7, label %15
]
7: ; preds = %4
br label %19
8: ; preds = %4
br label %19
9: ; preds = %4
br label %19
10: ; preds = %4
br label %19
11: ; preds = %4
br label %19
12: ; preds = %4
br label %19
13: ; preds = %4
%14 = bitcast [8 x i8]* %5 to i32*
store i32 3158308, i32* %14
br label %19
15: ; preds = %4
%16 = bitcast [8 x i8]* %5 to i32*
store i32 3223844, i32* %16
br label %19
17: ; preds = %4
%18 = bitcast [8 x i8]* %5 to i32*
store i32 3420708, i32* %18
br label %19
19: ; preds = %17, %15, %13, %12, %11, %10, %9, %8, %7
%20 = icmp eq i32 %1, 0
br i1 %20, label %21, label %25
21: ; preds = %19
%22 = tail call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %2)
%23 = shl nsw i32 %3, 2
%24 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* %6, i32 %23)
br label %28
25: ; preds = %19
%26 = shl nsw i32 %3, 2
%27 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8* %6, i8* %2, i32 %26)
br label %28
28: ; preds = %25, %21
%29 = icmp sgt i32 %0, 7
br i1 %29, label %30, label %34
30: ; preds = %28
%31 = shl i32 %0, 3
%32 = add i32 %31, -60
%33 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* %6, i32 %32)
br label %34
34: ; preds = %30, %28
ret i32 1
}