#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*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *,
                           char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ process_file_xim(char *);
int /*<<< orphan*/ process_file_xpm(char *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int i;
  if (argc < 2) {
    printf("ZIC2XPM 2.01 - by Frank McIngvale (frankm@hiwaay.net)\n");
    printf("Copyright (C) 1996 Free Software Foundation, Inc.\n\n");
    printf("Usage: zic2xpm file1 [file2 ...]\n\n");
    printf("  Splits each file (ZIICS piece files) into 26 XPM & XIM files\n");
    printf("  suitable for use in XBoard 3.5 or later.\n");
    printf(
        "\n* ZIICS is a copyrighted work of Andy McFarland (Zek on ICC) *\n");
    return 1;
  }
  setbuf(stdout, NULL);
  for (i = 1; i < argc; ++i) {
    process_file_xpm(argv[i]);
    process_file_xim(argv[i]);
  }
  fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
          "NOTICE: The piece images distributed with ZIICS are",
          "    copyrighted works of their original creators.  Images",
          "    converted with zic2xpm may not be redistributed without",
          "    the permission of the copyright holders.  Do not contact",
          "    the authors of zic2xpm or of ZIICS itself to request",
          "    permission.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11c4 <main+0x74>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
call   1040 <printf@plt>
lea    0xf27(%rip),%rdi
call   1040 <printf@plt>
lea    0xf47(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1268 <main+0x118>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1219 <main+0xc9>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <process_file_xpm@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <process_file_xim@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11dd <main+0x8d>
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
lea    0xf12(%rip),%rsi
lea    0xf1e(%rip),%rdx
lea    0xf4b(%rip),%rcx
lea    0xf7e(%rip),%r8
lea    0xfb3(%rip),%r9
lea    0xfe9(%rip),%r10
lea    0x101b(%rip),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jg     11ab <main+0x5b>
lea    0xfe3(%rip),%rdi
call   1030 <puts@plt>
lea    0x100d(%rip),%rdi
call   1030 <puts@plt>
lea    0x1034(%rip),%rdi
call   1030 <puts@plt>
lea    0x104a(%rip),%rdi
call   1030 <puts@plt>
lea    0x107d(%rip),%rdi
call   1030 <puts@plt>
lea    0x109c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    1232 <main+0xe2>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
mov    %ebp,%r14d
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdi
call   1050 <process_file_xpm@plt>
mov    (%rbx,%rbp,8),%rdi
call   1070 <process_file_xim@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11d0 <main+0x80>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xf38(%rip),%rax
lea    0xef8(%rip),%rbp
lea    0xdf7(%rip),%rsi
lea    0xe03(%rip),%rdx
lea    0xe30(%rip),%rcx
lea    0xe63(%rip),%r8
lea    0xe98(%rip),%r9
push   %rax
push   %rbp
call   1060 <fprintf@plt>
add    $0x10,%rsp
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [55 x i8] c"ZIC2XPM 2.01 - by Frank McIngvale (frankm@hiwaay.net)\0A\00"
@.str.1 = [52 x i8] c"Copyright (C) 1996 Free Software Foundation, Inc.\0A\0A\00"
@.str.2 = [35 x i8] c"Usage: zic2xpm file1 [file2 ...]\0A\0A\00"
@.str.3 = [64 x i8] c" Splits each file (ZIICS piece files) into 26 XPM & XIM files\0A\00"
@.str.4 = [44 x i8] c" suitable for use in XBoard 3.5 or later.\0A\00"
@.str.5 = [65 x i8] c"\0A* ZIICS is a copyrighted work of Andy McFarland (Zek on ICC) *\0A\00"
@stdout = global i32 0
@stderr = global i32 0
@.str.6 = [19 x i8] c"%s\0A%s\0A%s\0A%s\0A%s\0A%s\0A\00"
@.str.7 = [52 x i8] c"NOTICE: The piece images distributed with ZIICS are\00"
@.str.8 = [58 x i8] c" copyrighted works of their original creators. Images\00"
@.str.9 = [60 x i8] c" converted with zic2xpm may not be redistributed without\00"
@.str.10 = [61 x i8] c" the permission of the copyright holders. Do not contact\00"
@.str.11 = [57 x i8] c" the authors of zic2xpm or of ZIICS itself to request\00"
@.str.12 = [16 x i8] c" permission.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %42
16: ; preds = %2
%17 = load i32, i32* @stdout
%18 = call i32 @setbuf(i32 %17, i32* null)
store i32 1, i32* %6
br label %19
19: ; preds = %36, %16
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %39
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @process_file_xpm(i8* %28)
%30 = load i8**, i8*** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @process_file_xim(i8* %34)
br label %36
36: ; preds = %23
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %19
39: ; preds = %19
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %3
br label %42
42: ; preds = %39, %9
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str.6 = [19 x i8] c"%s\0A%s\0A%s\0A%s\0A%s\0A%s\0A\00"
@.str.7 = [52 x i8] c"NOTICE: The piece images distributed with ZIICS are\00"
@.str.8 = [58 x i8] c" copyrighted works of their original creators. Images\00"
@.str.9 = [60 x i8] c" converted with zic2xpm may not be redistributed without\00"
@.str.10 = [61 x i8] c" the permission of the copyright holders. Do not contact\00"
@.str.11 = [57 x i8] c" the authors of zic2xpm or of ZIICS itself to request\00"
@.str.12 = [16 x i8] c" permission.\00"
@str = [54 x i8] c"ZIC2XPM 2.01 - by Frank McIngvale (frankm@hiwaay.net)\00"
@str.13 = [51 x i8] c"Copyright (C) 1996 Free Software Foundation, Inc.\0A\00"
@str.14 = [34 x i8] c"Usage: zic2xpm file1 [file2 ...]\0A\00"
@str.15 = [63 x i8] c" Splits each file (ZIICS piece files) into 26 XPM & XIM files\00"
@str.16 = [43 x i8] c" suitable for use in XBoard 3.5 or later.\00"
@str.17 = [64 x i8] c"\0A* ZIICS is a copyrighted work of Andy McFarland (Zek on ICC) *\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.13, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.14, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.15, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.16, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.17, i64 0, i64 0))
br label %27
11: ; preds = %2
%12 = load i32, i32* @stdout
%13 = tail call i32 @setbuf(i32 %12, i32* null)
%14 = zext i32 %0 to i64
br label %15
15: ; preds = %11, %15
%16 = phi i64 [ 1, %11 ], [ %22, %15 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 @process_file_xpm(i8* %18)
%20 = load i8*, i8** %17
%21 = tail call i32 @process_file_xim(i8* %20)
%22 = add nuw nsw i64 %16, 1
%23 = icmp eq i64 %22, %14
br i1 %23, label %24, label %15
24: ; preds = %15
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
br label %27
27: ; preds = %24, %4
%28 = phi i32 [ 1, %4 ], [ 0, %24 ]
ret i32 %28
}