#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int EXIT_SUCCESS;
int cc_check(int /*<<< orphan*/ *, int, char *);
int /*<<< orphan*/ cc_freelists();
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main(int argc, char **argv) {
  int i, chk, len;
  char realcheck;
  for (i = 1; i < argc; i++) {
    len = strlen(argv[i]);
    chk = cc_check((uint8_t *)argv[i], strlen(argv[i]), &realcheck);
    printf("%s: ", argv[i]);
    switch (chk) {
    case -5:
      printf("Seen before, but ");
    case 1:
      printf("OK\n");
      break;
    case 0:
      printf("Maybe OK\n");
      break;
    case -1:
      printf("Fail: Blacklist\n");
      break;
    case -2:
      printf("Fail: Whitelist\n");
      break;
    case -3:
      printf("Fail: Length\n");
      break;
    case -4:
      argv[i][len - 1] = realcheck;
      printf(" -> %s\n", argv[i]);
    }
    cc_freelists();
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    129e <main+0x15e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    %rdi,-0x30(%rbp)
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
lea    -0x1d(%rbp),%rdx
call   1060 <cc_check@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x5,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x6,%eax
ja     1289 <main+0x149>
mov    -0x28(%rbp),%rax
lea    0xe22(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1289 <main+0x149>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1289 <main+0x149>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1289 <main+0x149>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1289 <main+0x149>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1289 <main+0x149>
mov    -0x1d(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <cc_freelists@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x1d>
mov    0x2d3b(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     124a <main+0xfa>
mov    %rsi,%rbx
mov    %edi,%r13d
mov    $0x1,%r14d
lea    0xe89(%rip),%r15
jmp    11a7 <main+0x57>
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <cc_freelists@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     124a <main+0xfa>
mov    (%rbx,%r14,8),%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    (%rbx,%r14,8),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %rbp,%rdi
mov    %eax,%esi
lea    0x7(%rsp),%rdx
call   1070 <cc_check@plt>
mov    %eax,%ebp
mov    (%rbx,%r14,8),%rsi
lea    0xe41(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x5,%ebp
cmp    $0x6,%ebp
ja     1193 <main+0x43>
movslq (%r15,%rbp,4),%rax
add    %r15,%rax
jmp    *%rax
movzbl 0x7(%rsp),%eax
mov    (%rbx,%r14,8),%rcx
movslq %r12d,%rdx
mov    %al,-0x1(%rdx,%rcx,1)
mov    (%rbx,%r14,8),%rsi
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1193 <main+0x43>
lea    0xe1a(%rip),%rdi
jmp    118e <main+0x3e>
lea    0xe1b(%rip),%rdi
jmp    118e <main+0x3e>
lea    0xe1f(%rip),%rdi
jmp    118e <main+0x3e>
lea    0xe23(%rip),%rdi
jmp    118e <main+0x3e>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [18 x i8] c"Seen before, but \00"
@.str.2 = [4 x i8] c"OK\0A\00"
@.str.3 = [10 x i8] c"Maybe OK\0A\00"
@.str.4 = [17 x i8] c"Fail: Blacklist\0A\00"
@.str.5 = [17 x i8] c"Fail: Whitelist\0A\00"
@.str.6 = [14 x i8] c"Fail: Length\0A\00"
@.str.7 = [8 x i8] c" -> %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %10
10: ; preds = %72, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %75
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %8
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = bitcast i8* %25 to i32*
%27 = load i8**, i8*** %5
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @strlen(i8* %31)
%33 = call i32 @cc_check(i32* %26, i32 %32, i8* %9)
store i32 %33, i32* %7
%34 = load i8**, i8*** %5
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %38)
%40 = load i32, i32* %7
switch i32 %40, label %70 [
i32 -5, label %41
i32 1, label %43
i32 0, label %45
i32 -1, label %47
i32 -2, label %49
i32 -3, label %51
i32 -4, label %53
]
41: ; preds = %14
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %14, %41
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %70
45: ; preds = %14
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %70
47: ; preds = %14
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %70
49: ; preds = %14
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %70
51: ; preds = %14
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %70
53: ; preds = %14
%54 = load i8, i8* %9
%55 = load i8**, i8*** %5
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = load i32, i32* %8
%61 = sub nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %59, i64 %62
store i8 %54, i8* %63
%64 = load i8**, i8*** %5
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %68)
br label %70
70: ; preds = %53, %14, %51, %49, %47, %45, %43
%71 = call i32 (...) @cc_freelists()
br label %72
72: ; preds = %70
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 1
store i32 %74, i32* %6
br label %10
75: ; preds = %10
%76 = load i32, i32* @EXIT_SUCCESS
ret i32 %76
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [18 x i8] c"Seen before, but \00"
@.str.7 = [8 x i8] c" -> %s\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [13 x i8] c"Fail: Length\00"
@str.8 = [16 x i8] c"Fail: Whitelist\00"
@str.9 = [16 x i8] c"Fail: Blacklist\00"
@str.10 = [9 x i8] c"Maybe OK\00"
@str.11 = [3 x i8] c"OK\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %42
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %38
%8 = phi i64 [ 1, %5 ], [ %40, %38 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = call i32 @strlen(i8* %10)
%12 = load i8*, i8** %9
%13 = bitcast i8* %12 to i32*
%14 = call i32 @strlen(i8* %12)
%15 = call i32 @cc_check(i32* %13, i32 %14, i8* %3)
%16 = load i8*, i8** %9
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %16)
switch i32 %15, label %38 [
i32 -5, label %18
i32 1, label %20
i32 0, label %22
i32 -1, label %24
i32 -2, label %26
i32 -3, label %28
i32 -4, label %30
]
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %7, %18
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.11, i64 0, i64 0))
br label %38
22: ; preds = %7
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0))
br label %38
24: ; preds = %7
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.9, i64 0, i64 0))
br label %38
26: ; preds = %7
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
br label %38
28: ; preds = %7
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %38
30: ; preds = %7
%31 = load i8, i8* %3
%32 = load i8*, i8** %9
%33 = add nsw i32 %11, -1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 %31, i8* %35
%36 = load i8*, i8** %9
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %30, %7, %28, %26, %24, %22, %20
%39 = call i32 (...) @cc_freelists()
%40 = add nuw nsw i64 %8, 1
%41 = icmp eq i64 %40, %6
br i1 %41, label %42, label %7
42: ; preds = %38, %2
%43 = load i32, i32* @EXIT_SUCCESS
ret i32 %43
}