#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*/ Delay_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 < 6)
      sprintf(r, "%%o%d", offset);
    else
      strcpy(r, "%l7");
    ;
    Delay_Printf("sethi",
                 "%%hi("
                 "%s+%d),%s",
                 name, index * 4, r);
    if (adr_of)
      Delay_Printf("or",
                   "%s,%%lo("
                   "%s+%d),%s",
                   r, name, index * 4, r);
    else
      Delay_Printf("ld",
                   "[%s+%%lo("
                   "%s+%d)],%s",
                   r, name, index * 4, r);
    if (offset >= 6)
      Delay_Printf("st", "%s,[%%sp+%d]", r, 92 + (offset - 6) * 4);
  };
  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   $0x6,-0x4(%rbp)
jge    1167 <Call_C_Arg_Mem_L+0x37>
lea    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xea3(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1177 <Call_C_Arg_Mem_L+0x47>
lea    -0x18(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
lea    -0x18(%rbp),%r8
lea    0xe7e(%rip),%rdi
lea    0xe7d(%rip),%rsi
mov    $0x0,%al
call   1050 <Delay_Printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11d2 <Call_C_Arg_Mem_L+0xa2>
lea    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
shl    $0x2,%r8d
lea    -0x18(%rbp),%r9
lea    0xe60(%rip),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1050 <Delay_Printf@plt>
jmp    11fb <Call_C_Arg_Mem_L+0xcb>
lea    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
shl    $0x2,%r8d
lea    -0x18(%rbp),%r9
lea    0xe47(%rip),%rdi
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1050 <Delay_Printf@plt>
cmpl   $0x6,-0x4(%rbp)
jl     122a <Call_C_Arg_Mem_L+0xfa>
lea    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
sub    $0x6,%ecx
shl    $0x2,%ecx
add    $0x5c,%ecx
lea    0xe2f(%rip),%rdi
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1050 <Delay_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    $0x5,%edi
jg     115b <Call_C_Arg_Mem_L+0x2b>
lea    0xeb3(%rip),%rsi
lea    0x4(%rsp),%rdi
mov    %ebx,%edx
call   1040 <sprintf@plt>
jmp    116c <Call_C_Arg_Mem_L+0x3c>
lea    0xea4(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1030 <strcpy@plt>
shl    $0x2,%ebp
lea    0xe94(%rip),%rdi
lea    0xe93(%rip),%rsi
lea    0x4(%rsp),%r8
mov    %r14,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <Delay_Printf@plt>
test   %r15d,%r15d
je     11a3 <Call_C_Arg_Mem_L+0x73>
lea    0xe85(%rip),%rdi
lea    0xe81(%rip),%rsi
jmp    11b1 <Call_C_Arg_Mem_L+0x81>
lea    0xe8a(%rip),%rdi
lea    0xe86(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %rdx,%r9
xor    %eax,%eax
call   1050 <Delay_Printf@plt>
cmp    $0x6,%ebx
jl     11ec <Call_C_Arg_Mem_L+0xbc>
lea    0x44(,%rbx,4),%ecx
lea    0xe72(%rip),%rdi
lea    0xe6e(%rip),%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1050 <Delay_Printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%%o%d\00"
@.str.1 = [4 x i8] c"%l7\00"
@.str.2 = [6 x i8] c"sethi\00"
@.str.3 = [15 x i8] c"%%hi(%s+%d),%s\00"
@.str.4 = [3 x i8] c"or\00"
@.str.5 = [18 x i8] c"%s,%%lo(%s+%d),%s\00"
@.str.6 = [3 x i8] c"ld\00"
@.str.7 = [20 x i8] c"[%s+%%lo(%s+%d)],%s\00"
@.str.8 = [3 x i8] c"st\00"
@.str.9 = [13 x i8] c"%s,[%%sp+%d]\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, 6
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %12
10: ; preds = %4
%11 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = shl nsw i32 %3, 2
%14 = call i32 (i8*, i8*, i8*, ...) @Delay_Printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %2, i32 %13, i8* %6)
%15 = icmp eq i32 %1, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 (i8*, i8*, i8*, ...) @Delay_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %6, i8* %2, i32 %13, i8* %6)
br label %20
18: ; preds = %12
%19 = call i32 (i8*, i8*, i8*, ...) @Delay_Printf(i8* getelementptr inbounds ([3 x i8], [3 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 %13, i8* %6)
br label %20
20: ; preds = %18, %16
%21 = icmp sgt i32 %0, 5
br i1 %21, label %22, label %26
22: ; preds = %20
%23 = shl i32 %0, 2
%24 = add i32 %23, 68
%25 = call i32 (i8*, i8*, i8*, ...) @Delay_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8* %6, i32 %24)
br label %26
26: ; preds = %22, %20
ret i32 1
}