#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ memcmp(char *, char *, int);
scalar_t__ readandwrite(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *in, *out;
  if (argc != 3) {
    fprintf(stderr, "Usage : %s /path/to/NAME.scel /path/to/NAME.pyim\n",
            argv[0]);
    return EXIT_FAILURE;
  }
  if ((in = fopen(argv[1], "rb")) == NULL) {
    fprintf(stderr, "Could not find \"%s\"\n", argv[1]);
    return EXIT_FAILURE;
  }
  char buffer[12];
  fread(buffer, 1, 12, in);
  if (memcmp(buffer, "\x40\x15\x00\x00\x44\x43\x53\x01\x01\x00\x00\x00", 12)) {
    fclose(in);
    fprintf(stderr, "\"%s\" is not a valid scel file.\n", argv[1]);
    return EXIT_FAILURE;
  }
  if ((out = fopen(argv[2], "wb")) == NULL) {
    fprintf(stderr, "Could not open \"%s\"\n", argv[2]);
    return EXIT_FAILURE;
  }
  fprintf(out, ";; -*- coding: utf-8-unix; -*-\n");
  if (readandwrite(in, out) < 0) {
    fprintf(stderr, "\"%s\" is not a valid scel file.\n", argv[1]);
    return EXIT_FAILURE;
  }
  fclose(in);
  fclose(out);
  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   $0x3,-0x8(%rbp)
je     11af <main+0x4f>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1336 <main+0x1d6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1201 <main+0xa1>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1336 <main+0x1d6>
lea    -0x2c(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0xc,%edx
call   1030 <fread@plt>
lea    -0x2c(%rbp),%rdi
lea    0xe7f(%rip),%rsi
mov    $0xc,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     1270 <main+0x110>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1336 <main+0x1d6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdeb(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    12c2 <main+0x162>
mov    0x2d47(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xdc3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1336 <main+0x1d6>
mov    -0x20(%rbp),%rax
mov    %eax,%edi
lea    0xdb3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <readandwrite@plt>
cmp    $0x0,%rax
jge    131d <main+0x1bd>
mov    0x2cec(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd45(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2cc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1336 <main+0x1d6>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    11de <main+0x7e>
mov    0x8(%rbx),%rdi
lea    0xeb5(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11f3 <main+0x93>
mov    %rax,%r14
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0xc,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
lea    0xef7(%rip),%rsi
mov    %rbp,%rdi
mov    $0xc,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     1209 <main+0xa9>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe71(%rip),%rsi
jmp    126a <main+0x10a>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe0f(%rip),%rsi
jmp    126a <main+0x10a>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe2e(%rip),%rsi
jmp    126a <main+0x10a>
mov    0x10(%rbx),%rdi
lea    0xe56(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1256 <main+0xf6>
mov    %rax,%r15
lea    0xe5a(%rip),%rsi
xor    %ebp,%ebp
mov    %r15d,%edi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <readandwrite@plt>
test   %rax,%rax
js     11c5 <main+0x65>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
jmp    127a <main+0x11a>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xe03(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Usage : %s /path/to/NAME.scel /path/to/NAME.pyim\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [21 x i8] c"Could not find \22%s\22\0A\00"
@.str.3 = [13 x i8] c"@\15\00\00DCS\01\01\00\00\00\00"
@.str.4 = [32 x i8] c"\22%s\22 is not a valid scel file.\0A\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [21 x i8] c"Could not open \22%s\22\0A\00"
@.str.7 = [32 x i8] c";; -*- coding: utf-8-unix; -*-\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [12 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
store i32 %17, i32* %3
br label %80
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %6
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %31
24: ; preds = %18
%25 = load i32, i32* @stderr
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @EXIT_FAILURE
store i32 %30, i32* %3
br label %80
31: ; preds = %18
%32 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%33 = load i32*, i32** %6
%34 = call i32 @fread(i8* %32, i32 1, i32 12, i32* %33)
%35 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%36 = call i64 @memcmp(i8* %35, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 12)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %47
38: ; preds = %31
%39 = load i32*, i32** %6
%40 = call i32 @fclose(i32* %39)
%41 = load i32, i32* @stderr
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %44)
%46 = load i32, i32* @EXIT_FAILURE
store i32 %46, i32* %3
br label %80
47: ; preds = %31
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 2
%50 = load i8*, i8** %49
%51 = call i32* @fopen(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %51, i32** %7
%52 = icmp eq i32* %51, null
br i1 %52, label %53, label %60
53: ; preds = %47
%54 = load i32, i32* @stderr
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %57)
%59 = load i32, i32* @EXIT_FAILURE
store i32 %59, i32* %3
br label %80
60: ; preds = %47
%61 = load i32*, i32** %7
%62 = ptrtoint i32* %61 to i32
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%64 = load i32*, i32** %6
%65 = load i32*, i32** %7
%66 = call i64 @readandwrite(i32* %64, i32* %65)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %75
68: ; preds = %60
%69 = load i32, i32* @stderr
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 1
%72 = load i8*, i8** %71
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %72)
%74 = load i32, i32* @EXIT_FAILURE
store i32 %74, i32* %3
br label %80
75: ; preds = %60
%76 = load i32*, i32** %6
%77 = call i32 @fclose(i32* %76)
%78 = load i32*, i32** %7
%79 = call i32 @fclose(i32* %78)
store i32 0, i32* %3
br label %80
80: ; preds = %75, %68, %53, %38, %24, %11
%81 = load i32, i32* %3
ret i32 %81
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Usage : %s /path/to/NAME.scel /path/to/NAME.pyim\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [21 x i8] c"Could not find \22%s\22\0A\00"
@.str.3 = [13 x i8] c"@\15\00\00DCS\01\01\00\00\00\00"
@.str.4 = [32 x i8] c"\22%s\22 is not a valid scel file.\0A\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [21 x i8] c"Could not open \22%s\22\0A\00"
@.str.7 = [32 x i8] c";; -*- coding: utf-8-unix; -*-\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [12 x i8]
%4 = icmp eq i32 %0, 3
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
br label %57
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %11
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
br label %57
20: ; preds = %10
%21 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%22 = call i32 @fread(i8* %21, i32 1, i32 12, i32* %13)
%23 = call i64 @memcmp(i8* %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 12)
%24 = icmp eq i64 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %20
%26 = call i32 @fclose(i32* %13)
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %11
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @EXIT_FAILURE
br label %55
31: ; preds = %20
%32 = getelementptr inbounds i8*, i8** %1, i64 2
%33 = load i8*, i8** %32
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %41
36: ; preds = %31
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %32
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%40 = load i32, i32* @EXIT_FAILURE
br label %55
41: ; preds = %31
%42 = ptrtoint i32* %34 to i64
%43 = trunc i64 %42 to i32
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%45 = call i64 @readandwrite(i32* %13, i32* %34)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %52
47: ; preds = %41
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %11
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
br label %55
52: ; preds = %41
%53 = call i32 @fclose(i32* %13)
%54 = call i32 @fclose(i32* %34)
br label %55
55: ; preds = %52, %47, %36, %25
%56 = phi i32 [ %30, %25 ], [ %40, %36 ], [ %51, %47 ], [ 0, %52 ]
br label %57
57: ; preds = %55, %15, %5
%58 = phi i32 [ %9, %5 ], [ %19, %15 ], [ %56, %55 ]
ret i32 %58
}