#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*/ AnyDiskInserted();
int /*<<< orphan*/ Sony_Insert2(char *);
int LoadInitialImages(void) {
  if (!AnyDiskInserted()) {
    int n = 6 > 9 ? 9 : 6;
    int i;
    char s[] = "disk?.dsk";
    for (i = 1; i <= n; ++i) {
      s[4] = '0' + i;
      if (!Sony_Insert2(s)) {
        return 1;
      }
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<LoadInitialImages>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <AnyDiskInserted@plt>
cmp    $0x0,%eax
jne    11a7 <LoadInitialImages+0x87>
movl   $0x6,-0x8(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x16(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0xe(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a2 <LoadInitialImages+0x82>
mov    -0xc(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x12(%rbp)
lea    -0x16(%rbp),%rdi
call   1030 <Sony_Insert2@plt>
cmp    $0x0,%eax
jne    118f <LoadInitialImages+0x6f>
movl   $0x1,-0x4(%rbp)
jmp    11ae <LoadInitialImages+0x8e>
jmp    1194 <LoadInitialImages+0x74>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <LoadInitialImages+0x3c>
jmp    11a7 <LoadInitialImages+0x87>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LoadInitialImages>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <AnyDiskInserted@plt>
test   %eax,%eax
je     1139 <LoadInitialImages+0x19>
mov    $0x1,%eax
add    $0x18,%rsp
ret
movabs $0x73642e3f6b736964,%rax
2e 64 73
mov    %rax,0x8(%rsp)
movw   $0x6b,0x10(%rsp)
movb   $0x31,0xc(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <Sony_Insert2@plt>
test   %eax,%eax
je     112f <LoadInitialImages+0xf>
movb   $0x32,0xc(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <Sony_Insert2@plt>
test   %eax,%eax
je     112f <LoadInitialImages+0xf>
movb   $0x33,0xc(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <Sony_Insert2@plt>
test   %eax,%eax
je     112f <LoadInitialImages+0xf>
movb   $0x34,0xc(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <Sony_Insert2@plt>
test   %eax,%eax
je     112f <LoadInitialImages+0xf>
movb   $0x35,0xc(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <Sony_Insert2@plt>
test   %eax,%eax
je     112f <LoadInitialImages+0xf>
movb   $0x36,0xc(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <Sony_Insert2@plt>
jmp    112f <LoadInitialImages+0xf>

LLVM IR (-O0):
@__const.LoadInitialImages.s = [10 x i8] c"disk?.dsk\00"
define i32 @LoadInitialImages() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = call i32 (...) @AnyDiskInserted()
%6 = icmp ne i32 %5, 0
br i1 %6, label %27, label %7
7: ; preds = %0
store i32 6, i32* %2
%8 = bitcast [10 x i8]* %4 to i8*
store i32 1, i32* %3
br label %9
9: ; preds = %23, %7
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 48, %14
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 4
store i8 %16, i8* %17
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%19 = call i32 @Sony_Insert2(i8* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %13
store i32 1, i32* %1
br label %28
22: ; preds = %13
br label %23
23: ; preds = %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %9
26: ; preds = %9
br label %27
27: ; preds = %26, %0
store i32 1, i32* %1
br label %28
28: ; preds = %27, %21
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@__const.LoadInitialImages.s = [10 x i8] c"disk?.dsk\00"
define i32 @LoadInitialImages() {
%1 = alloca [10 x i8]
%2 = tail call i32 (...) @AnyDiskInserted()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %24
4: ; preds = %0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
store i8 49, i8* %6
%7 = call i32 @Sony_Insert2(i8* %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %23, label %9
9: ; preds = %4
store i8 50, i8* %6
%10 = call i32 @Sony_Insert2(i8* %5)
%11 = icmp eq i32 %10, 0
br i1 %11, label %23, label %12
12: ; preds = %9
store i8 51, i8* %6
%13 = call i32 @Sony_Insert2(i8* %5)
%14 = icmp eq i32 %13, 0
br i1 %14, label %23, label %15
15: ; preds = %12
store i8 52, i8* %6
%16 = call i32 @Sony_Insert2(i8* %5)
%17 = icmp eq i32 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %15
store i8 53, i8* %6
%19 = call i32 @Sony_Insert2(i8* %5)
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
store i8 54, i8* %6
%22 = call i32 @Sony_Insert2(i8* %5)
br label %23
23: ; preds = %21, %18, %15, %12, %9, %4
br label %24
24: ; preds = %23, %0
ret i32 1
}