#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__ strcmp(char const *, char *);
int check_params(int argc, const char **argv) {
  if (argc < 2) {
    return 0;
  } else if (strcmp(argv[1], "--help") != 0 && argc < 3) {
    return 0;
  } else if (strcmp(argv[1], "--triangle") == 0 && argc < 8) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1135 <check_params+0x25>
movl   $0x0,-0x4(%rbp)
jmp    11ae <check_params+0x9e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1169 <check_params+0x59>
cmpl   $0x3,-0x8(%rbp)
jge    1169 <check_params+0x59>
movl   $0x0,-0x4(%rbp)
jmp    11ae <check_params+0x9e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    119d <check_params+0x8d>
cmpl   $0x8,-0x8(%rbp)
jge    119d <check_params+0x8d>
movl   $0x0,-0x4(%rbp)
jmp    11ae <check_params+0x9e>
jmp    11a2 <check_params+0x92>
jmp    11a7 <check_params+0x97>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_params>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
cmp    $0x2,%edi
jl     115b <check_params+0x4b>
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x2,%ebx
jne    113a <check_params+0x2a>
test   %rax,%rax
jne    115b <check_params+0x4b>
mov    0x8(%r14),%rdi
lea    0xec2(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
setne  %al
cmp    $0x8,%ebx
setae  %cl
or     %al,%cl
movzbl %cl,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [11 x i8] c"--triangle\00"
define i32 @check_params(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 = icmp slt i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %32
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 0, i32* %3
br label %32
19: ; preds = %15, %9
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %19
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 8
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 0, i32* %3
br label %32
29: ; preds = %25, %19
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
store i32 1, i32* %3
br label %32
32: ; preds = %31, %28, %18, %8
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [11 x i8] c"--triangle\00"
define i32 @check_params(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
%9 = icmp eq i32 %0, 2
%10 = and i1 %9, %8
br i1 %10, label %18, label %11
11: ; preds = %4
%12 = load i8*, i8** %5
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
%15 = icmp ugt i32 %0, 7
%16 = or i1 %15, %14
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %11, %4, %2
%19 = phi i32 [ 0, %2 ], [ 0, %4 ], [ %17, %11 ]
ret i32 %19
}