#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 */
size_t env_get_size(char const **);
int ft_print(char *, int, int /*<<< orphan*/);
int valid_input_or_die(const char **args) {
  size_t args_size;
  if (!args)
    return (ft_print("unsetenv :\t"
                     "An error occured.\n",
                     2, 0));
  args_size = env_get_size(args);
  if (args_size == 1)
    return (ft_print("unsetenv :\t"
                     "Error. Not enough arguments.\n",
                     2, 0));
  else if (args_size == 0)
    return (ft_print("unsetenv :\t"
                     "An error occured.\n",
                     2, 0));
  else
    return (1);
}


x86 assembly (clang, -O0):
<valid_input_or_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1152 <valid_input_or_die+0x32>
lea    0xec2(%rip),%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <ft_print@plt>
mov    %eax,-0x4(%rbp)
jmp    11b2 <valid_input_or_die+0x92>
mov    -0x10(%rbp),%rdi
call   1030 <env_get_size@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
jne    1185 <valid_input_or_die+0x65>
lea    0xead(%rip),%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <ft_print@plt>
mov    %eax,-0x4(%rbp)
jmp    11b2 <valid_input_or_die+0x92>
cmpq   $0x0,-0x18(%rbp)
jne    11ab <valid_input_or_die+0x8b>
lea    0xe69(%rip),%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <ft_print@plt>
mov    %eax,-0x4(%rbp)
jmp    11b2 <valid_input_or_die+0x92>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_input_or_die>:
push   %rbx
lea    0xed8(%rip),%rbx
test   %rdi,%rdi
je     114b <valid_input_or_die+0x2b>
call   1030 <env_get_size@plt>
cmp    $0x1,%rax
je     1144 <valid_input_or_die+0x24>
test   %rax,%rax
je     114b <valid_input_or_die+0x2b>
mov    $0x1,%eax
pop    %rbx
ret
lea    0xed3(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
pop    %rbx
jmp    1040 <ft_print@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"unsetenv :\09An error occured.\0A\00"
@.str.1 = [41 x i8] c"unsetenv :\09Error. Not enough arguments.\0A\00"
define i32 @valid_input_or_die(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i64
store i8** %0, i8*** %3
%5 = load i8**, i8*** %3
%6 = icmp ne i8** %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @ft_print(i8* getelementptr inbounds ([30 x i8], [30 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 = call i64 @env_get_size(i8** %10)
store i64 %11, i64* %4
%12 = load i64, i64* %4
%13 = icmp eq i64 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 @ft_print(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 0)
store i32 %15, i32* %2
br label %22
16: ; preds = %9
%17 = load i64, i64* %4
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @ft_print(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 2, i32 0)
store i32 %20, i32* %2
br label %22
21: ; preds = %16
store i32 1, i32* %2
br label %22
22: ; preds = %21, %19, %14, %7
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [30 x i8] c"unsetenv :\09An error occured.\0A\00"
@.str.1 = [41 x i8] c"unsetenv :\09Error. Not enough arguments.\0A\00"
define i32 @valid_input_or_die(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 @env_get_size(i8** %0)
switch i64 %4, label %9 [
i64 1, label %6
i64 0, label %5
]
5: ; preds = %3
br label %6
6: ; preds = %3, %1, %5
%7 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), %5 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), %3 ]
%8 = tail call i32 @ft_print(i8* %7, i32 2, i32 0)
br label %9
9: ; preds = %6, %3
%10 = phi i32 [ 1, %3 ], [ %8, %6 ]
ret i32 %10
}