#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 /*<<< orphan*/ doWSYS(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  FILE *infile = NULL;
  unsigned char buf[4];
  int i;
  if (argc != 2) {
    fprintf(stderr, "one argument: something.wsys\n");
    return 1;
  }
  infile = fopen(argv[1], "rb");
  if (!infile) {
    fprintf(stderr, "error opening %s\n", argv[1]);
    return 1;
  }
  doWSYS(infile, 0);
  fclose(infile);
  infile = NULL;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     118b <main+0x4b>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f5 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe84(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11d9 <main+0x99>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe5b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f5 <main+0xb5>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1060 <doWSYS@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    117a <main+0x3a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xec7(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1193 <main+0x53>
mov    %rax,%r14
xor    %ebx,%ebx
mov    %rax,%rdi
xor    %esi,%esi
call   1060 <doWSYS@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
jmp    11b3 <main+0x73>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11ae <main+0x6e>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe7a(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"one argument: something.wsys\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [18 x i8] c"error opening %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [4 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %32
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %6
%19 = load i32*, i32** %6
%20 = icmp ne i32* %19, null
br i1 %20, label %27, label %21
21: ; preds = %14
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %25)
store i32 1, i32* %3
br label %32
27: ; preds = %14
%28 = load i32*, i32** %6
%29 = call i32 @doWSYS(i32* %28, i32 0)
%30 = load i32*, i32** %6
%31 = call i32 @fclose(i32* %30)
store i32* null, i32** %6
br label %32
32: ; preds = %27, %21, %11
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"one argument: something.wsys\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [18 x i8] c"error opening %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %19
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %8
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %19
16: ; preds = %7
%17 = tail call i32 @doWSYS(i32* %10, i32 0)
%18 = tail call i32 @fclose(i32* %10)
br label %19
19: ; preds = %16, %12, %4
%20 = phi i32 [ 1, %4 ], [ 0, %16 ], [ 1, %12 ]
ret i32 %20
}