#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 */
scalar_t__ create_dir(char *);
int /*<<< orphan*/ is_dir(char *);
scalar_t__ path_reformat(char *);
int /*<<< orphan*/ printf(char *);
int check_parameters(char *input, char *output) {
  if (input == NULL || output == NULL)
    return -1;
  if (path_reformat(input) < 0)
    goto err_input;
  if (!is_dir(input))
    goto err_input;
  if (path_reformat(output) < 0)
    goto err_output;
  if (!is_dir(output)) {
    if (create_dir(output) < 0)
      goto err_output;
  }
  return 0;
err_input:
  printf("Error : Invalid input directory\n");
  return -1;
err_output:
  printf("Error : Couldn't create output directory\n");
  return -1;
}


x86 assembly (clang, -O0):
<check_parameters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1166 <check_parameters+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1172 <check_parameters+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    121f <check_parameters+0xdf>
mov    -0x10(%rbp),%rdi
call   1030 <path_reformat@plt>
cmp    $0x0,%rax
jge    118a <check_parameters+0x4a>
jmp    11f4 <check_parameters+0xb4>
mov    -0x10(%rbp),%rdi
call   1050 <is_dir@plt>
cmp    $0x0,%eax
jne    11a1 <check_parameters+0x61>
jmp    11f4 <check_parameters+0xb4>
mov    -0x18(%rbp),%rdi
call   1030 <path_reformat@plt>
cmp    $0x0,%rax
jge    11b9 <check_parameters+0x79>
jmp    120c <check_parameters+0xcc>
mov    -0x18(%rbp),%rdi
call   1050 <is_dir@plt>
cmp    $0x0,%eax
jne    11e8 <check_parameters+0xa8>
mov    -0x18(%rbp),%rdi
call   1060 <create_dir@plt>
cmp    $0x0,%rax
jge    11e3 <check_parameters+0xa3>
jmp    120c <check_parameters+0xcc>
jmp    11e8 <check_parameters+0xa8>
movl   $0x0,-0x4(%rbp)
jmp    121f <check_parameters+0xdf>
lea    0xe05(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121f <check_parameters+0xdf>
lea    0xe0e(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_parameters>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebp
test   %rdi,%rdi
je     11b5 <check_parameters+0x75>
mov    %rsi,%r15
test   %rsi,%rsi
je     11b5 <check_parameters+0x75>
mov    %rdi,%rbx
call   1040 <path_reformat@plt>
lea    0xe98(%rip),%r14
test   %rax,%rax
js     11a8 <check_parameters+0x68>
mov    %rbx,%rdi
call   1050 <is_dir@plt>
test   %eax,%eax
je     11a8 <check_parameters+0x68>
mov    %r15,%rdi
call   1040 <path_reformat@plt>
lea    0xe98(%rip),%r14
test   %rax,%rax
js     11a8 <check_parameters+0x68>
mov    %r15,%rdi
call   1050 <is_dir@plt>
xor    %ebp,%ebp
test   %eax,%eax
jne    11b5 <check_parameters+0x75>
mov    %r15,%rdi
call   1060 <create_dir@plt>
test   %rax,%rax
jns    11b5 <check_parameters+0x75>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Error : Invalid input directory\0A\00"
@.str.1 = [42 x i8] c"Error : Couldn't create output directory\0A\00"
define i32 @check_parameters(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 -1, i32* %3
br label %42
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = call i64 @path_reformat(i8* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
br label %38
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = call i32 @is_dir(i8* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %17
br label %38
22: ; preds = %17
%23 = load i8*, i8** %5
%24 = call i64 @path_reformat(i8* %23)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
br label %40
27: ; preds = %22
%28 = load i8*, i8** %5
%29 = call i32 @is_dir(i8* %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %37, label %31
31: ; preds = %27
%32 = load i8*, i8** %5
%33 = call i64 @create_dir(i8* %32)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31
br label %40
36: ; preds = %31
br label %37
37: ; preds = %36, %27
store i32 0, i32* %3
br label %42
38: ; preds = %21, %16
%39 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %42
40: ; preds = %35, %26
%41 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %42
42: ; preds = %40, %38, %37, %11
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@str = [32 x i8] c"Error : Invalid input directory\00"
@str.2 = [41 x i8] c"Error : Couldn't create output directory\00"
define i32 @check_parameters(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %24, label %6
6: ; preds = %2
%7 = tail call i64 @path_reformat(i8* %0)
%8 = icmp slt i64 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %6
%10 = tail call i32 @is_dir(i8* %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %9
%13 = tail call i64 @path_reformat(i8* %1)
%14 = icmp slt i64 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %12
%16 = tail call i32 @is_dir(i8* %1)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = tail call i64 @create_dir(i8* %1)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %12, %18, %6, %9
%22 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0), %9 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0), %6 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @str.2, i64 0, i64 0), %18 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @str.2, i64 0, i64 0), %12 ]
%23 = tail call i32 @puts(i8* dereferenceable(1) %22)
br label %24
24: ; preds = %21, %15, %18, %2
%25 = phi i32 [ -1, %2 ], [ 0, %18 ], [ 0, %15 ], [ -1, %21 ]
ret i32 %25
}