#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__ strcasecmp(char *, char *);
int do_toggle(int *dest, int argc, char **argv) {
  if (argc < 2)
    return -1;
  if (strcasecmp(argv[1], "true") == 0 || strcasecmp(argv[1], "on") == 0 ||
      strcasecmp(argv[1], "1") == 0 || strcasecmp(argv[1], "enable") == 0 ||
      strcasecmp(argv[1], "enabled") == 0 || strcasecmp(argv[1], "yes") == 0) {
    *dest = 1;
    return 1;
  }
  *dest = 0;
  return 0;
}


x86 assembly (clang, -O0):
<do_toggle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1139 <do_toggle+0x29>
movl   $0xffffffff,-0x4(%rbp)
jmp    1214 <do_toggle+0x104>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb8(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11ed <do_toggle+0xdd>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11ed <do_toggle+0xdd>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe84(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11ed <do_toggle+0xdd>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11ed <do_toggle+0xdd>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe51(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11ed <do_toggle+0xdd>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1203 <do_toggle+0xf3>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1214 <do_toggle+0x104>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_toggle>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffffff,%ebp
cmp    $0x2,%esi
jl     11ad <do_toggle+0x9d>
mov    %rdi,%r14
mov    0x8(%rdx),%rbx
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     11aa <do_toggle+0x9a>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11aa <do_toggle+0x9a>
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11aa <do_toggle+0x9a>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11aa <do_toggle+0x9a>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11aa <do_toggle+0x9a>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,(%r14)
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [3 x i8] c"on\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [7 x i8] c"enable\00"
@.str.4 = [8 x i8] c"enabled\00"
@.str.5 = [4 x i8] c"yes\00"
define i32 @do_toggle(i32* nocapture writeonly %0, i32 %1, i8** nocapture %2) {
%4 = icmp slt i32 %1, 2
br i1 %4, label %28, label %5
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %2, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @strcasecmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %5
%11 = tail call i64 @strcasecmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %26, label %13
13: ; preds = %10
%14 = tail call i64 @strcasecmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %26, label %16
16: ; preds = %13
%17 = tail call i64 @strcasecmp(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %16
%20 = tail call i64 @strcasecmp(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = tail call i64 @strcasecmp(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
%25 = zext i1 %24 to i32
br label %26
26: ; preds = %22, %5, %10, %13, %16, %19
%27 = phi i32 [ 1, %19 ], [ 1, %16 ], [ 1, %13 ], [ 1, %10 ], [ 1, %5 ], [ %25, %22 ]
store i32 %27, i32* %0
br label %28
28: ; preds = %26, %3
%29 = phi i32 [ -1, %3 ], [ %27, %26 ]
ret i32 %29
}