#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*/ V_DrawPatchDirect(int, int, int /*<<< orphan*/,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ W_CacheLumpName(char *, int);
void M_DrawSaveLoadBorder(int x, int y) {
  int i;
  V_DrawPatchDirect(x - 8, y + 7, 0, W_CacheLumpName("M_LSLEFT", 101));
  for (i = 0; i < 24; i++) {
    V_DrawPatchDirect(x, y + 7, 0, W_CacheLumpName("M_LSCNTR", 101));
    x += 8;
  }
  V_DrawPatchDirect(x, y + 7, 0, W_CacheLumpName("M_LSRGHT", 101));
}


x86 assembly (clang, -O0):
<M_DrawSaveLoadBorder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x10(%rbp)
lea    0xeb9(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    %eax,%ecx
xor    %edx,%edx
call   1030 <V_DrawPatchDirect@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x18,-0xc(%rbp)
jge    11b7 <M_DrawSaveLoadBorder+0x97>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x18(%rbp)
lea    0xe82(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    %eax,%ecx
xor    %edx,%edx
call   1030 <V_DrawPatchDirect@plt>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <M_DrawSaveLoadBorder+0x47>
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x20(%rbp)
lea    0xe45(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    %eax,%ecx
xor    %edx,%edx
call   1030 <V_DrawPatchDirect@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M_DrawSaveLoadBorder>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
mov    %edi,%r12d
lea    -0x8(%r12),%r14d
add    $0x7,%r15d
lea    0xec2(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
xor    %ebx,%ebx
mov    %r14d,%edi
mov    %r15d,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <V_DrawPatchDirect@plt>
lea    0xea9(%rip),%r14
lea    (%r12,%rbx,1),%ebp
mov    %r14,%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    %ebp,%edi
mov    %r15d,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <V_DrawPatchDirect@plt>
add    $0x8,%ebx
cmp    $0xc0,%ebx
jne    1160 <M_DrawSaveLoadBorder+0x40>
lea    0xe81(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
add    %ebx,%r12d
mov    %r12d,%edi
mov    %r15d,%esi
xor    %edx,%edx
mov    %eax,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <V_DrawPatchDirect@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"M_LSLEFT\00"
@.str.1 = [9 x i8] c"M_LSCNTR\00"
@.str.2 = [9 x i8] c"M_LSRGHT\00"
define void @M_DrawSaveLoadBorder(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %6, 8
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 7
%10 = call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 101)
%11 = call i32 @V_DrawPatchDirect(i32 %7, i32 %9, i32 0, i32 %10)
store i32 0, i32* %5
br label %12
12: ; preds = %23, %2
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 24
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 7
%19 = call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 101)
%20 = call i32 @V_DrawPatchDirect(i32 %16, i32 %18, i32 0, i32 %19)
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 8
store i32 %22, i32* %3
br label %23
23: ; preds = %15
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %12
26: ; preds = %12
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 7
%30 = call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 101)
%31 = call i32 @V_DrawPatchDirect(i32 %27, i32 %29, i32 0, i32 %30)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"M_LSLEFT\00"
@.str.1 = [9 x i8] c"M_LSCNTR\00"
@.str.2 = [9 x i8] c"M_LSRGHT\00"
define void @M_DrawSaveLoadBorder(i32 %0, i32 %1) {
%3 = add nsw i32 %0, -8
%4 = add nsw i32 %1, 7
%5 = tail call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 101)
%6 = tail call i32 @V_DrawPatchDirect(i32 %3, i32 %4, i32 0, i32 %5)
br label %7
7: ; preds = %2, %7
%8 = phi i32 [ 0, %2 ], [ %13, %7 ]
%9 = phi i32 [ %0, %2 ], [ %12, %7 ]
%10 = tail call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 101)
%11 = tail call i32 @V_DrawPatchDirect(i32 %9, i32 %4, i32 0, i32 %10)
%12 = add nsw i32 %9, 8
%13 = add nuw nsw i32 %8, 1
%14 = icmp eq i32 %13, 24
br i1 %14, label %15, label %7
15: ; preds = %7
%16 = tail call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 101)
%17 = tail call i32 @V_DrawPatchDirect(i32 %12, i32 %4, i32 0, i32 %16)
ret void
}