#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*/ print_file_error(char *);
int /*<<< orphan*/ print_number_error(char *);
int /*<<< orphan*/ print_usage_error();
int /*<<< orphan*/ valid_input(char *);
int /*<<< orphan*/ valid_interations(char *);
int /*<<< orphan*/ valid_processors(char *);
int /*<<< orphan*/ valid_size(int);
int check_input(int argc, char *argv[]) {
  if (!valid_size(argc)) {
    print_usage_error();
    return 0;
  }
  if (!valid_input(argv[1])) {
    print_file_error(argv[1]);
    return 0;
  }
  if (!valid_processors(argv[3])) {
    print_number_error(argv[3]);
    return 0;
  }
  if (!valid_interations(argv[4])) {
    print_number_error(argv[4]);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <valid_size@plt>
cmp    $0x0,%eax
jne    11a3 <check_input+0x33>
mov    $0x0,%al
call   1070 <print_usage_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    1237 <check_input+0xc7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <valid_input@plt>
cmp    $0x0,%eax
jne    11d2 <check_input+0x62>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <print_file_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    1237 <check_input+0xc7>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <valid_processors@plt>
cmp    $0x0,%eax
jne    1201 <check_input+0x91>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1090 <print_number_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    1237 <check_input+0xc7>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1080 <valid_interations@plt>
cmp    $0x0,%eax
jne    1230 <check_input+0xc0>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1090 <print_number_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    1237 <check_input+0xc7>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_input>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1040 <valid_size@plt>
test   %eax,%eax
je     11b1 <check_input+0x41>
mov    0x8(%rbx),%rdi
call   1050 <valid_input@plt>
test   %eax,%eax
je     11bc <check_input+0x4c>
mov    0x18(%rbx),%rdi
call   1060 <valid_processors@plt>
test   %eax,%eax
je     11c7 <check_input+0x57>
mov    0x20(%rbx),%rdi
call   1080 <valid_interations@plt>
mov    $0x1,%ebp
test   %eax,%eax
jne    11d2 <check_input+0x62>
mov    0x20(%rbx),%rdi
jmp    11cb <check_input+0x5b>
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <print_usage_error@plt>
jmp    11d2 <check_input+0x62>
mov    0x8(%rbx),%rdi
call   1030 <print_file_error@plt>
jmp    11d0 <check_input+0x60>
mov    0x18(%rbx),%rdi
call   1090 <print_number_error@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_input(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = call i32 @valid_size(i32 %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 (...) @print_usage_error()
store i32 0, i32* %3
br label %45
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @valid_input(i8* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %22, label %17
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @print_file_error(i8* %20)
store i32 0, i32* %3
br label %45
22: ; preds = %11
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call i32 @valid_processors(i8* %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %22
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
%32 = call i32 @print_number_error(i8* %31)
store i32 0, i32* %3
br label %45
33: ; preds = %22
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 4
%36 = load i8*, i8** %35
%37 = call i32 @valid_interations(i8* %36)
%38 = icmp ne i32 %37, 0
br i1 %38, label %44, label %39
39: ; preds = %33
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 4
%42 = load i8*, i8** %41
%43 = call i32 @print_number_error(i8* %42)
store i32 0, i32* %3
br label %45
44: ; preds = %33
store i32 1, i32* %3
br label %45
45: ; preds = %44, %39, %28, %17, %9
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
define i32 @check_input(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @valid_size(i32 %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @print_usage_error()
br label %31
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @valid_input(i8* %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i8*, i8** %8
%14 = tail call i32 @print_file_error(i8* %13)
br label %31
15: ; preds = %7
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32 @valid_processors(i8* %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i8*, i8** %16
%22 = tail call i32 @print_number_error(i8* %21)
br label %31
23: ; preds = %15
%24 = getelementptr inbounds i8*, i8** %1, i64 4
%25 = load i8*, i8** %24
%26 = tail call i32 @valid_interations(i8* %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i8*, i8** %24
%30 = tail call i32 @print_number_error(i8* %29)
br label %31
31: ; preds = %23, %28, %20, %12, %5
%32 = phi i32 [ 0, %28 ], [ 0, %20 ], [ 0, %12 ], [ 0, %5 ], [ 1, %23 ]
ret i32 %32
}