#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 *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int Call_C_Arg_Mem_L(int offset, int adr_of, char *name, int index) {
  {
    char r[4];
    if (offset < 8)
      sprintf(r,
              "r"
              "%d",
              offset + 3);
    else
      strcpy(r, "r"
                "11");
    ;
    Inst_Printf("addis",
                "%s,0,"
                "ha16("
                "_"
                "%s+%d"
                ")",
                r, name, index * 4);
    if (adr_of)
      Inst_Printf("addi",
                  "%s,%s,"
                  "lo16("
                  "_"
                  "%s+%d"
                  ")",
                  r, r, name, index * 4);
    else
      Inst_Printf("lwz",
                  "%s,"
                  "lo16("
                  "_"
                  "%s+%d"
                  ")"
                  "(%s)",
                  r, name, index * 4, r);
    if (offset >= 8)
      Inst_Printf("stw",
                  "%s,%d("
                  "r"
                  "1"
                  ")",
                  r, offset * 4 + 24);
  };
  return 1;
}


x86 assembly (clang, -O0):
<Call_C_Arg_Mem_L>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    116a <Call_C_Arg_Mem_L+0x3a>
lea    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
add    $0x3,%edx
lea    0xea0(%rip),%rsi
call   1050 <sprintf@plt>
jmp    117a <Call_C_Arg_Mem_L+0x4a>
lea    -0x18(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
shl    $0x2,%r8d
lea    0xe77(%rip),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11d7 <Call_C_Arg_Mem_L+0xa7>
lea    -0x18(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x14(%rbp),%r9d
shl    $0x2,%r9d
lea    0xe5c(%rip),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
jmp    1200 <Call_C_Arg_Mem_L+0xd0>
lea    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
shl    $0x2,%r8d
lea    -0x18(%rbp),%r9
lea    0xe46(%rip),%rdi
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
cmpl   $0x8,-0x4(%rbp)
jl     122c <Call_C_Arg_Mem_L+0xfc>
lea    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x18,%ecx
lea    0xe32(%rip),%rdi
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Call_C_Arg_Mem_L>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %esi,%r15d
mov    %edi,%ebx
cmp    $0x7,%edi
jg     115c <Call_C_Arg_Mem_L+0x2c>
lea    0x3(%rbx),%edx
lea    0xeb0(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1050 <sprintf@plt>
jmp    116d <Call_C_Arg_Mem_L+0x3d>
lea    0xea1(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1040 <strcpy@plt>
shl    $0x2,%ebp
lea    0xe91(%rip),%rdi
lea    0xe90(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %r14,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
test   %r15d,%r15d
je     11ee <Call_C_Arg_Mem_L+0xbe>
lea    0xe84(%rip),%rdi
lea    0xe82(%rip),%rsi
lea    0x4(%rsp),%rcx
mov    %rcx,%rdx
mov    %r14,%r8
mov    %ebp,%r9d
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
cmp    $0x8,%ebx
jl     11de <Call_C_Arg_Mem_L+0xae>
lea    0x18(,%rbx,4),%ecx
lea    0xe85(%rip),%rdi
lea    0xe82(%rip),%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe43(%rip),%rdi
lea    0xe40(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %rdx,%r9
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
cmp    $0x8,%ebx
jge    11bd <Call_C_Arg_Mem_L+0x8d>
jmp    11de <Call_C_Arg_Mem_L+0xae>

LLVM IR (-O0):
@.str = [4 x i8] c"r%d\00"
@.str.1 = [4 x i8] c"r11\00"
@.str.2 = [6 x i8] c"addis\00"
@.str.3 = [18 x i8] c"%s,0,ha16(_%s+%d)\00"
@.str.4 = [5 x i8] c"addi\00"
@.str.5 = [19 x i8] c"%s,%s,lo16(_%s+%d)\00"
@.str.6 = [4 x i8] c"lwz\00"
@.str.7 = [20 x i8] c"%s,lo16(_%s+%d)(%s)\00"
@.str.8 = [4 x i8] c"stw\00"
@.str.9 = [10 x i8] c"%s,%d(r1)\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 [4 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
%11 = icmp slt i32 %10, 8
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 3
%16 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %20
17: ; preds = %4
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%19 = call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %17, %12
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%22 = load i8*, i8** %7
%23 = load i32, i32* %8
%24 = mul nsw i32 %23, 4
%25 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %21, i8* %22, i32 %24)
%26 = load i32, i32* %6
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %20
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%31 = load i8*, i8** %7
%32 = load i32, i32* %8
%33 = mul nsw i32 %32, 4
%34 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %29, i8* %30, i8* %31, i32 %33)
br label %42
35: ; preds = %20
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%37 = load i8*, i8** %7
%38 = load i32, i32* %8
%39 = mul nsw i32 %38, 4
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%41 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %36, i8* %37, i32 %39, i8* %40)
br label %42
42: ; preds = %35, %28
%43 = load i32, i32* %5
%44 = icmp sge i32 %43, 8
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%47 = load i32, i32* %5
%48 = mul nsw i32 %47, 4
%49 = add nsw i32 %48, 24
%50 = 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 ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %46, i32 %49)
br label %51
51: ; preds = %45, %42
ret i32 1
}

LLVM IR (-O2):
@.str = [4 x i8] c"r%d\00"
@.str.1 = [4 x i8] c"r11\00"
@.str.2 = [6 x i8] c"addis\00"
@.str.3 = [18 x i8] c"%s,0,ha16(_%s+%d)\00"
@.str.4 = [5 x i8] c"addi\00"
@.str.5 = [19 x i8] c"%s,%s,lo16(_%s+%d)\00"
@.str.6 = [4 x i8] c"lwz\00"
@.str.7 = [20 x i8] c"%s,lo16(_%s+%d)(%s)\00"
@.str.8 = [4 x i8] c"stw\00"
@.str.9 = [10 x i8] c"%s,%d(r1)\00"
define i32 @Call_C_Arg_Mem_L(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca [4 x i8]
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%7 = icmp slt i32 %0, 8
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = add nsw i32 %0, 3
%10 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %13
11: ; preds = %4
%12 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = shl nsw i32 %3, 2
%15 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %6, i8* %2, i32 %14)
%16 = icmp eq i32 %1, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %6, i8* %6, i8* %2, i32 %14)
br label %21
19: ; preds = %13
%20 = call i32 (i8*, i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %6, i8* %2, i32 %14, i8* %6)
br label %21
21: ; preds = %19, %17
%22 = icmp sgt i32 %0, 7
br i1 %22, label %23, label %27
23: ; preds = %21
%24 = shl nsw i32 %0, 2
%25 = add nsw i32 %24, 24
%26 = 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 ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %6, i32 %25)
br label %27
27: ; preds = %23, %21
ret i32 1
}