#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*/ fetx_test(char *, char *, unsigned long, unsigned long);
int /*<<< orphan*/ puts(char *);
unsigned long strtol(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  unsigned long int multiply_driven = 0;
  switch (argc) {
  case 4:
    break;
  case 5:
    multiply_driven = strtol(argv[4], 0, 0);
    break;
  default:
    puts("Incorrect number of arguments. fetx-test takes 3 or 4 arguments\n"
         "1: The netlist pathname\n2: The test vector pathname\n"
         "3: The limit on time before the circuit resolves, in time instances\n"
         "4: The number of times inputs should be recorded as multiply driven "
         "(defaults to 0)");
    return -1;
  }
  fetx_test(argv[1], argv[2], multiply_driven, strtol(argv[3], 0, 0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x4,%eax
je     1173 <main+0x43>
jmp    1162 <main+0x32>
mov    -0x1c(%rbp),%eax
sub    $0x5,%eax
je     1178 <main+0x48>
jmp    1192 <main+0x62>
jmp    11aa <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <strtol@plt>
mov    %rax,-0x18(%rbp)
jmp    11aa <main+0x7a>
lea    0xe67(%rip),%rdi
call   1040 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f6 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <strtol@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %rax,%rcx
call   1030 <fetx_test@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%rbx
xor    %r14d,%r14d
cmp    $0x4,%edi
je     115b <main+0x2b>
cmp    $0x5,%edi
jne    1186 <main+0x56>
mov    0x20(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %rax,%r15
jmp    115e <main+0x2e>
xor    %r15d,%r15d
mov    0x8(%rbx),%r12
mov    0x10(%rbx),%r13
mov    0x18(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %rax,%rcx
call   1030 <fetx_test@plt>
jmp    1198 <main+0x68>
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [268 x i8] c"Incorrect number of arguments. fetx-test takes 3 or 4 arguments\0A1: The netlist pathname\0A2: The test vector pathname\0A3: The limit on time before the circuit resolves, in time instances\0A4: The number of times inputs should be recorded as multiply driven (defaults to 0)\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
%7 = load i32, i32* %4
switch i32 %7, label %14 [
i32 4, label %8
i32 5, label %9
]
8: ; preds = %2
br label %16
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 4
%12 = load i8*, i8** %11
%13 = call i64 @strtol(i8* %12, i32 0, i32 0)
store i64 %13, i64* %6
br label %16
14: ; preds = %2
%15 = call i32 @puts(i8* getelementptr inbounds ([268 x i8], [268 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %29
16: ; preds = %9, %8
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = load i64, i64* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i64 @strtol(i8* %26, i32 0, i32 0)
%28 = call i32 @fetx_test(i8* %19, i8* %22, i64 %23, i64 %27)
store i32 0, i32* %3
br label %29
29: ; preds = %16, %14
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [268 x i8] c"Incorrect number of arguments. fetx-test takes 3 or 4 arguments\0A1: The netlist pathname\0A2: The test vector pathname\0A3: The limit on time before the circuit resolves, in time instances\0A4: The number of times inputs should be recorded as multiply driven (defaults to 0)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %7 [
i32 4, label %9
i32 5, label %3
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 4
%5 = load i8*, i8** %4
%6 = tail call i64 @strtol(i8* %5, i32 0, i32 0)
br label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([268 x i8], [268 x i8]* @.str, i64 0, i64 0))
br label %19
9: ; preds = %3, %2
%10 = phi i64 [ %6, %3 ], [ 0, %2 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i64 @strtol(i8* %16, i32 0, i32 0)
%18 = tail call i32 @fetx_test(i8* %12, i8* %14, i64 %10, i64 %17)
br label %19
19: ; preds = %9, %7
%20 = phi i32 [ -1, %7 ], [ 0, %9 ]
ret i32 %20
}