#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*/ exit(int);
int /*<<< orphan*/ process_flag(char *);
scalar_t__ strcmp(char *, char *);
void perform_flag_yes_no_checks(int argc, char **argv) {
  for (int i = 1; i < argc; i++) {
    if (argv[i][0] == '-') {
      if (argv[i][1] == '\0') {
        exit(1);
      } else {
        process_flag(argv[i] + 1);
      }
    } else if (strcmp(argv[i], "update") != 0) {
      exit(1);
    }
  }
}


x86 assembly (clang, -O0):
<perform_flag_yes_no_checks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11eb <perform_flag_yes_no_checks+0xbb>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11a7 <perform_flag_yes_no_checks+0x77>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    118d <perform_flag_yes_no_checks+0x5d>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x1,%rdi
call   1040 <process_flag@plt>
jmp    11d8 <perform_flag_yes_no_checks+0xa8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe46(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11d3 <perform_flag_yes_no_checks+0xa3>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11d8 <perform_flag_yes_no_checks+0xa8>
jmp    11dd <perform_flag_yes_no_checks+0xad>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <perform_flag_yes_no_checks+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perform_flag_yes_no_checks>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1190 <perform_flag_yes_no_checks+0x60>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xeb1(%rip),%r14
jmp    1176 <perform_flag_yes_no_checks+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    119c <perform_flag_yes_no_checks+0x6c>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1190 <perform_flag_yes_no_checks+0x60>
mov    (%r15,%rbx,8),%rdi
cmpb   $0x2d,(%rdi)
jne    1160 <perform_flag_yes_no_checks+0x30>
cmpb   $0x0,0x1(%rdi)
je     119c <perform_flag_yes_no_checks+0x6c>
add    $0x1,%rdi
call   1040 <process_flag@plt>
jmp    116d <perform_flag_yes_no_checks+0x3d>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"update\00"
define void @perform_flag_yes_no_checks(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %7
6: ; preds = %26, %2
ret void
7: ; preds = %4, %26
%8 = phi i64 [ 1, %4 ], [ %27, %26 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 45
br i1 %12, label %13, label %21
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %13
%20 = tail call i32 @process_flag(i8* %14)
br label %26
21: ; preds = %7
%22 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %19, %21
%27 = add nuw nsw i64 %8, 1
%28 = icmp eq i64 %27, %5
br i1 %28, label %6, label %7
}