#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 /*<<< orphan*/ display_params(char *);
scalar_t__ my_strcmp(char *, char *);
int check_params(int ac, char **av, char *color) {
  int i;
  i = 0;
  *color = 0;
  while (++i < ac) {
    if (my_strcmp(av[i], "-c") || my_strcmp(av[i], "--color"))
      *color = 1;
    else if (my_strcmp(av[i], "-h") || my_strcmp(av[i], "--help")) {
      display_params(av[0]);
      return (-1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<check_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmp    -0x8(%rbp),%eax
jge    1209 <check_params+0xe9>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <my_strcmp@plt>
cmp    $0x0,%rax
jne    1197 <check_params+0x77>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe7b(%rip),%rsi
call   1040 <my_strcmp@plt>
cmp    $0x0,%rax
je     11a3 <check_params+0x83>
mov    -0x18(%rbp),%rax
movb   $0x1,(%rax)
jmp    1204 <check_params+0xe4>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe55(%rip),%rsi
call   1040 <my_strcmp@plt>
cmp    $0x0,%rax
jne    11e7 <check_params+0xc7>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe36(%rip),%rsi
call   1040 <my_strcmp@plt>
cmp    $0x0,%rax
je     11ff <check_params+0xdf>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <display_params@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1210 <check_params+0xf0>
jmp    1204 <check_params+0xe4>
jmp    1141 <check_params+0x21>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_params>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x0,(%rdx)
xor    %eax,%eax
cmp    $0x2,%edi
jl     11ca <check_params+0xaa>
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %edi,%r13d
mov    $0x1,%r14d
lea    0xeb1(%rip),%r15
lea    0xead(%rip),%r12
jmp    116d <check_params+0x4d>
nopl   0x0(%rax,%rax,1)
movb   $0x1,0x0(%rbp)
add    $0x1,%r14
cmp    %r14,%r13
je     11c8 <check_params+0xa8>
mov    (%rbx,%r14,8),%rdi
mov    %r15,%rsi
call   1040 <my_strcmp@plt>
test   %rax,%rax
jne    1160 <check_params+0x40>
mov    (%rbx,%r14,8),%rdi
mov    %r12,%rsi
call   1040 <my_strcmp@plt>
test   %rax,%rax
jne    1160 <check_params+0x40>
mov    (%rbx,%r14,8),%rdi
lea    0xe71(%rip),%rsi
call   1040 <my_strcmp@plt>
test   %rax,%rax
jne    11b9 <check_params+0x99>
mov    (%rbx,%r14,8),%rdi
lea    0xe5f(%rip),%rsi
call   1040 <my_strcmp@plt>
test   %rax,%rax
je     1164 <check_params+0x44>
mov    (%rbx),%rdi
call   1030 <display_params@plt>
mov    $0xffffffff,%eax
jmp    11ca <check_params+0xaa>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-c\00"
@.str.1 = [8 x i8] c"--color\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [7 x i8] c"--help\00"
define i32 @check_params(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i32 0, i32* %8
%9 = load i8*, i8** %7
store i8 0, i8* %9
br label %10
10: ; preds = %55, %3
%11 = load i32, i32* %8
%12 = add nsw i32 %11, 1
store i32 %12, i32* %8
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %56
15: ; preds = %10
%16 = load i8**, i8*** %6
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @my_strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br i1 %22, label %31, label %23
23: ; preds = %15
%24 = load i8**, i8*** %6
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i64 @my_strcmp(i8* %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %23, %15
%32 = load i8*, i8** %7
store i8 1, i8* %32
br label %55
33: ; preds = %23
%34 = load i8**, i8*** %6
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i64 @my_strcmp(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp ne i64 %39, 0
br i1 %40, label %49, label %41
41: ; preds = %33
%42 = load i8**, i8*** %6
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = call i64 @my_strcmp(i8* %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %41, %33
%50 = load i8**, i8*** %6
%51 = getelementptr inbounds i8*, i8** %50, i64 0
%52 = load i8*, i8** %51
%53 = call i32 @display_params(i8* %52)
store i32 -1, i32* %4
br label %57
54: ; preds = %41
br label %55
55: ; preds = %54, %31
br label %10
56: ; preds = %10
store i32 0, i32* %4
br label %57
57: ; preds = %56, %49
%58 = load i32, i32* %4
ret i32 %58
}

LLVM IR (-O2):
@.str = [3 x i8] c"-c\00"
@.str.1 = [8 x i8] c"--color\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [7 x i8] c"--help\00"
define i32 @check_params(i32 %0, i8** nocapture %1, i8* nocapture writeonly %2) {
store i8 0, i8* %2
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %32
5: ; preds = %3
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %29
%8 = phi i64 [ 1, %5 ], [ %30, %29 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i64 @my_strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %7
%14 = load i8*, i8** %9
%15 = tail call i64 @my_strcmp(i8* %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %13, %7
store i8 1, i8* %2
br label %29
18: ; preds = %13
%19 = load i8*, i8** %9
%20 = tail call i64 @my_strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8*, i8** %9
%24 = tail call i64 @my_strcmp(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %22, %18
%27 = load i8*, i8** %1
%28 = tail call i32 @display_params(i8* %27)
br label %32
29: ; preds = %22, %17
%30 = add nuw nsw i64 %8, 1
%31 = icmp eq i64 %30, %6
br i1 %31, label %32, label %7
32: ; preds = %29, %3, %26
%33 = phi i32 [ -1, %26 ], [ 0, %3 ], [ 0, %29 ]
ret i32 %33
}