#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", "$16");
    break;
  case 1:
    sprintf(dest, "%s", "$17");
    break;
  case 2:
    sprintf(dest, "%s", "$18");
    break;
  case 3:
    sprintf(dest, "%s", "$19");
    break;
  case 4:
    sprintf(dest, "%s", "$20");
    break;
  case 5:
    sprintf(dest, "%s", "$21");
    break;
  default:
    sprintf(dest, "%s", "$1");
    break;
  }
  if (!adr_of) {
    Inst_Printf("lda", "$2,%s", name);
    Inst_Printf("ldq", "%s,%d($2)", dest, index * 8);
  } else {
    Inst_Printf("lda", "%s,%s+%d", dest, name, index * 8);
  }
  if (offset > 5) {
    Inst_Printf("stq", "%s,%d($30)", dest, (offset - 6) * 8);
  }
  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    $0x5,%rax
ja     1202 <Call_C_Arg_Mem_L+0xe2>
mov    -0x28(%rbp),%rax
lea    0xeaf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x1c(%rbp),%rdi
lea    0xed5(%rip),%rsi
lea    0xeac(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1219 <Call_C_Arg_Mem_L+0xf9>
lea    -0x1c(%rbp),%rdi
lea    0xeb9(%rip),%rsi
lea    0xe94(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1219 <Call_C_Arg_Mem_L+0xf9>
lea    -0x1c(%rbp),%rdi
lea    0xe9d(%rip),%rsi
lea    0xe7c(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1219 <Call_C_Arg_Mem_L+0xf9>
lea    -0x1c(%rbp),%rdi
lea    0xe81(%rip),%rsi
lea    0xe64(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1219 <Call_C_Arg_Mem_L+0xf9>
lea    -0x1c(%rbp),%rdi
lea    0xe65(%rip),%rsi
lea    0xe4c(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1219 <Call_C_Arg_Mem_L+0xf9>
lea    -0x1c(%rbp),%rdi
lea    0xe49(%rip),%rsi
lea    0xe34(%rip),%rdx
call   1040 <sprintf@plt>
jmp    1219 <Call_C_Arg_Mem_L+0xf9>
lea    -0x1c(%rbp),%rdi
lea    0xe2d(%rip),%rsi
lea    0xe1c(%rip),%rdx
call   1040 <sprintf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1260 <Call_C_Arg_Mem_L+0x140>
mov    -0x10(%rbp),%rdx
lea    0xe05(%rip),%rdi
lea    0xe02(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
lea    -0x1c(%rbp),%rdx
mov    -0x14(%rbp),%ecx
shl    $0x3,%ecx
lea    0xdf0(%rip),%rdi
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
jmp    1285 <Call_C_Arg_Mem_L+0x165>
lea    -0x1c(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
shl    $0x3,%r8d
lea    0xdbc(%rip),%rdi
lea    0xdcd(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
cmpl   $0x5,-0x4(%rbp)
jle    12b1 <Call_C_Arg_Mem_L+0x191>
lea    -0x1c(%rbp),%rdx
mov    -0x4(%rbp),%ecx
sub    $0x6,%ecx
shl    $0x3,%ecx
lea    0xdb1(%rip),%rdi
lea    0xdae(%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    $0x5,%edi
ja     1141 <Call_C_Arg_Mem_L+0x31>
mov    %ebx,%eax
lea    0xed8(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
movl   $0x363124,(%rsp)
test   %esi,%esi
jne    1187 <Call_C_Arg_Mem_L+0x77>
jmp    11e0 <Call_C_Arg_Mem_L+0xd0>
movb   $0x0,0x2(%rsp)
movw   $0x3124,(%rsp)
test   %esi,%esi
jne    1187 <Call_C_Arg_Mem_L+0x77>
jmp    11e0 <Call_C_Arg_Mem_L+0xd0>
movl   $0x373124,(%rsp)
test   %esi,%esi
jne    1187 <Call_C_Arg_Mem_L+0x77>
jmp    11e0 <Call_C_Arg_Mem_L+0xd0>
movl   $0x383124,(%rsp)
test   %esi,%esi
jne    1187 <Call_C_Arg_Mem_L+0x77>
jmp    11e0 <Call_C_Arg_Mem_L+0xd0>
movl   $0x393124,(%rsp)
test   %esi,%esi
jne    1187 <Call_C_Arg_Mem_L+0x77>
jmp    11e0 <Call_C_Arg_Mem_L+0xd0>
movl   $0x303224,(%rsp)
test   %esi,%esi
je     11e0 <Call_C_Arg_Mem_L+0xd0>
shl    $0x3,%ebp
lea    0xe8a(%rip),%rdi
lea    0xe9b(%rip),%rsi
mov    %rsp,%rdx
mov    %ebp,%r8d
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
cmp    $0x6,%ebx
jl     11c9 <Call_C_Arg_Mem_L+0xb9>
lea    -0x30(,%rbx,8),%ecx
lea    0xe84(%rip),%rdi
lea    0xe81(%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   $0x313224,(%rsp)
test   %esi,%esi
jne    1187 <Call_C_Arg_Mem_L+0x77>
lea    0xe34(%rip),%rdi
lea    0xe31(%rip),%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
shl    $0x3,%ebp
lea    0xe23(%rip),%rdi
lea    0xe20(%rip),%rsi
mov    %rsp,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
cmp    $0x6,%ebx
jge    11aa <Call_C_Arg_Mem_L+0x9a>
jmp    11c9 <Call_C_Arg_Mem_L+0xb9>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"$16\00"
@.str.2 = [4 x i8] c"$17\00"
@.str.3 = [4 x i8] c"$18\00"
@.str.4 = [4 x i8] c"$19\00"
@.str.5 = [4 x i8] c"$20\00"
@.str.6 = [4 x i8] c"$21\00"
@.str.7 = [3 x i8] c"$1\00"
@.str.8 = [4 x i8] c"lda\00"
@.str.9 = [6 x i8] c"$2,%s\00"
@.str.10 = [4 x i8] c"ldq\00"
@.str.11 = [10 x i8] c"%s,%d($2)\00"
@.str.12 = [9 x i8] c"%s,%s+%d\00"
@.str.13 = [4 x i8] c"stq\00"
@.str.14 = [11 x i8] c"%s,%d($30)\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 %29 [
i32 0, label %11
i32 1, label %14
i32 2, label %17
i32 3, label %20
i32 4, label %23
i32 5, label %26
]
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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %32
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 ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %32
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 ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %32
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 ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %32
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 ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %32
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 ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %32
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 ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %32
32: ; preds = %29, %26, %23, %20, %17, %14, %11
%33 = load i32, i32* %6
%34 = icmp ne i32 %33, 0
br i1 %34, label %42, label %35
35: ; preds = %32
%36 = load i8*, i8** %7
%37 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%39 = load i32, i32* %8
%40 = mul nsw i32 %39, 8
%41 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* %38, i32 %40)
br label %48
42: ; preds = %32
%43 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%44 = load i8*, i8** %7
%45 = load i32, i32* %8
%46 = mul nsw i32 %45, 8
%47 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* %43, i8* %44, i32 %46)
br label %48
48: ; preds = %42, %35
%49 = load i32, i32* %5
%50 = icmp sgt i32 %49, 5
br i1 %50, label %51, label %57
51: ; preds = %48
%52 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%53 = load i32, i32* %5
%54 = sub nsw i32 %53, 6
%55 = mul nsw i32 %54, 8
%56 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* %52, i32 %55)
br label %57
57: ; preds = %51, %48
ret i32 1
}

LLVM IR (-O2):
@.str.7 = [3 x i8] c"$1\00"
@.str.8 = [4 x i8] c"lda\00"
@.str.9 = [6 x i8] c"$2,%s\00"
@.str.10 = [4 x i8] c"ldq\00"
@.str.11 = [10 x i8] c"%s,%d($2)\00"
@.str.12 = [9 x i8] c"%s,%s+%d\00"
@.str.13 = [4 x i8] c"stq\00"
@.str.14 = [11 x i8] c"%s,%d($30)\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 %19 [
i32 0, label %7
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
]
7: ; preds = %4
%8 = bitcast [8 x i8]* %5 to i32*
store i32 3551524, i32* %8
br label %20
9: ; preds = %4
%10 = bitcast [8 x i8]* %5 to i32*
store i32 3617060, i32* %10
br label %20
11: ; preds = %4
%12 = bitcast [8 x i8]* %5 to i32*
store i32 3682596, i32* %12
br label %20
13: ; preds = %4
%14 = bitcast [8 x i8]* %5 to i32*
store i32 3748132, i32* %14
br label %20
15: ; preds = %4
%16 = bitcast [8 x i8]* %5 to i32*
store i32 3158564, i32* %16
br label %20
17: ; preds = %4
%18 = bitcast [8 x i8]* %5 to i32*
store i32 3224100, i32* %18
br label %20
19: ; preds = %4
br label %20
20: ; preds = %19, %17, %15, %13, %11, %9, %7
%21 = icmp eq i32 %1, 0
br i1 %21, label %22, label %26
22: ; preds = %20
%23 = tail call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %2)
%24 = shl nsw i32 %3, 3
%25 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* %6, i32 %24)
br label %29
26: ; preds = %20
%27 = shl nsw i32 %3, 3
%28 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* %6, i8* %2, i32 %27)
br label %29
29: ; preds = %26, %22
%30 = icmp sgt i32 %0, 5
br i1 %30, label %31, label %35
31: ; preds = %29
%32 = shl i32 %0, 3
%33 = add i32 %32, -48
%34 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* %6, i32 %33)
br label %35
35: ; preds = %31, %29
ret i32 1
}