#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 fetx_example_from_file(char *, char *);
int fetx_example_inverter();
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  switch (argc) {
  case 1:
    return fetx_example_inverter();
  case 3:
    return fetx_example_from_file(argv[1], argv[2]);
  default:
    puts("Incorrect number of arguments. fetx_example takes 0 or 2 "
         "arguments\n1: The netlist pathname\n2: The test vector pathname\n");
    return -1;
  }
  return 0;
}


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)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     116b <main+0x3b>
jmp    115a <main+0x2a>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     117a <main+0x4a>
jmp    1197 <main+0x67>
mov    $0x0,%al
call   1040 <fetx_example_inverter@plt>
mov    %eax,-0x4(%rbp)
jmp    11aa <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1050 <fetx_example_from_file@plt>
mov    %eax,-0x4(%rbp)
jmp    11aa <main+0x7a>
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
je     1143 <main+0x13>
cmp    $0x1,%edi
jne    1151 <main+0x21>
xor    %eax,%eax
pop    %rcx
jmp    1040 <fetx_example_inverter@plt>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
pop    %rax
jmp    1050 <fetx_example_from_file@plt>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [120 x i8] c"Incorrect number of arguments. fetx_example takes 0 or 2 arguments\0A1: The netlist pathname\0A2: The test vector pathname\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
switch i32 %6, label %17 [
i32 1, label %7
i32 3, label %9
]
7: ; preds = %2
%8 = call i32 (...) @fetx_example_inverter()
store i32 %8, i32* %3
br label %19
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @fetx_example_from_file(i8* %12, i8* %15)
store i32 %16, i32* %3
br label %19
17: ; preds = %2
%18 = call i32 @puts(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %19
19: ; preds = %17, %9, %7
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [120 x i8] c"Incorrect number of arguments. fetx_example takes 0 or 2 arguments\0A1: The netlist pathname\0A2: The test vector pathname\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %11 [
i32 1, label %3
i32 3, label %5
]
3: ; preds = %2
%4 = tail call i32 (...) @fetx_example_inverter()
br label %13
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @fetx_example_from_file(i8* %7, i8* %9)
br label %13
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([120 x i8], [120 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %5, %3
%14 = phi i32 [ -1, %11 ], [ %10, %5 ], [ %4, %3 ]
ret i32 %14
}