#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 env_get_size(char const **);
int ft_print(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ ft_strcmp(char *, char const *);
int valid_input_or_die(const char **args) {
  if (env_get_size(args) < 1)
    return (ft_print("echo :t"
                     "Error on input. Is your input reasonnable ?\n",
                     2, 0));
  if (!ft_strcmp("-n", args[1]) && args[2] == NULL)
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<valid_input_or_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <env_get_size@plt>
cmp    $0x1,%eax
jge    1169 <valid_input_or_die+0x39>
lea    0xeab(%rip),%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1050 <ft_print@plt>
mov    %eax,-0x4(%rbp)
jmp    11a8 <valid_input_or_die+0x78>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xebc(%rip),%rdi
call   1030 <ft_strcmp@plt>
cmp    $0x0,%eax
jne    11a1 <valid_input_or_die+0x71>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
jne    11a1 <valid_input_or_die+0x71>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <valid_input_or_die+0x78>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_input_or_die>:
push   %rbx
mov    %rdi,%rbx
call   1040 <env_get_size@plt>
test   %eax,%eax
jle    115f <valid_input_or_die+0x2f>
mov    0x8(%rbx),%rsi
lea    0xeec(%rip),%rdi
call   1030 <ft_strcmp@plt>
test   %eax,%eax
jne    1158 <valid_input_or_die+0x28>
cmpq   $0x0,0x10(%rbx)
je     1173 <valid_input_or_die+0x43>
mov    $0x1,%eax
pop    %rbx
ret
lea    0xe9a(%rip),%rdi
mov    $0x2,%esi
xor    %edx,%edx
pop    %rbx
jmp    1050 <ft_print@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"echo :tError on input. Is your input reasonnable ?\0A\00"
@.str.1 = [3 x i8] c"-n\00"
define i32 @valid_input_or_die(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = load i8**, i8*** %3
%5 = call i32 @env_get_size(i8** %4)
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @ft_print(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 2, i32 0)
store i32 %8, i32* %2
br label %22
9: ; preds = %1
%10 = load i8**, i8*** %3
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @ft_strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %9
%16 = load i8**, i8*** %3
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 0, i32* %2
br label %22
21: ; preds = %15, %9
store i32 1, i32* %2
br label %22
22: ; preds = %21, %20, %7
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [52 x i8] c"echo :tError on input. Is your input reasonnable ?\0A\00"
@.str.1 = [3 x i8] c"-n\00"
define i32 @valid_input_or_die(i8** %0) {
%2 = tail call i32 @env_get_size(i8** %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @ft_print(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 2, i32 0)
br label %16
6: ; preds = %1
%7 = getelementptr inbounds i8*, i8** %0, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @ft_strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = getelementptr inbounds i8*, i8** %0, i64 2
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %11, %6
br label %16
16: ; preds = %11, %15, %4
%17 = phi i32 [ %5, %4 ], [ 1, %15 ], [ 0, %11 ]
ret i32 %17
}