#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 NAME_MAX;
int PATH_MAX;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int strlen(char *);
void _check_invariant_conditions(int argc, char *argv[]) {
  if (argc == 1 || argc > 3) {
    fprintf(stderr, "usage: %s [starting point...] [expression]\n", argv[0]);
    exit(-1);
  }
  if (strlen(argv[1]) > PATH_MAX) {
    fprintf(stderr, "argument length: path cannot exceed %d characters\n",
            PATH_MAX);
    exit(-1);
  }
  if (argc > 3 && strlen(argv[2]) > NAME_MAX) {
    fprintf(stderr, "argument length: expression cannot exceed %d characters\n",
            NAME_MAX);
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<_check_invariant_conditions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     1153 <_check_invariant_conditions+0x23>
cmpl   $0x3,-0x4(%rbp)
jle    117b <_check_invariant_conditions+0x4b>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
mov    0x2e61(%rip),%rcx
cmp    (%rcx),%eax
jle    11c1 <_check_invariant_conditions+0x91>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
mov    0x2e49(%rip),%rax
mov    (%rax),%edx
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
cmpl   $0x3,-0x4(%rbp)
jle    1211 <_check_invariant_conditions+0xe1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <strlen@plt>
mov    0x2de9(%rip),%rcx
cmp    (%rcx),%eax
jle    1211 <_check_invariant_conditions+0xe1>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
mov    0x2dd1(%rip),%rax
mov    (%rax),%edx
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_invariant_conditions>:
push   %rax
cmp    $0x1,%edi
je     1153 <_check_invariant_conditions+0x23>
cmp    $0x4,%edi
jge    1153 <_check_invariant_conditions+0x23>
mov    0x8(%rsi),%rdi
call   1030 <strlen@plt>
mov    0x2ea5(%rip),%rcx
mov    (%rcx),%edx
cmp    %edx,%eax
jg     1177 <_check_invariant_conditions+0x47>
pop    %rax
ret
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe9a(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"usage: %s [starting point...] [expression]\0A\00"
@PATH_MAX = global i32 0
@.str.1 = [51 x i8] c"argument length: path cannot exceed %d characters\0A\00"
@NAME_MAX = global i32 0
@.str.2 = [57 x i8] c"argument length: expression cannot exceed %d characters\0A\00"
define void @_check_invariant_conditions(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 3
br i1 %9, label %10, label %17
10: ; preds = %7, %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %7
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strlen(i8* %20)
%22 = load i32, i32* @PATH_MAX
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %29
24: ; preds = %17
%25 = load i32, i32* @stderr
%26 = load i32, i32* @PATH_MAX
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @exit(i32 -1)
unreachable
29: ; preds = %17
%30 = load i32, i32* %3
%31 = icmp sgt i32 %30, 3
br i1 %31, label %32, label %44
32: ; preds = %29
%33 = load i8**, i8*** %4
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32 @strlen(i8* %35)
%37 = load i32, i32* @NAME_MAX
%38 = icmp sgt i32 %36, %37
br i1 %38, label %39, label %44
39: ; preds = %32
%40 = load i32, i32* @stderr
%41 = load i32, i32* @NAME_MAX
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %41)
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %32, %29
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"usage: %s [starting point...] [expression]\0A\00"
@PATH_MAX = global i32 0
@.str.1 = [51 x i8] c"argument length: path cannot exceed %d characters\0A\00"
@NAME_MAX = global i32 0
define void @_check_invariant_conditions(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
%4 = icmp sgt i32 %0, 3
%5 = or i1 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strlen(i8* %13)
%15 = load i32, i32* @PATH_MAX
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%20 = tail call i32 @exit(i32 -1)
unreachable
21: ; preds = %11
ret void
}