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

/* Variables and functions */
int /*<<< orphan*/ isxdigit(int);
scalar_t__ memcmp(int *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int, int, int);
int /*<<< orphan*/ writepsk(int /*<<< orphan*/ *, char *);
void testcabovisao(FILE *fhout, uint8_t essidlen, uint8_t *essid) {
  static int k1;
  static char *cabovisao = "Cabovisao-";
  static char essidtmp[64] = {};
  if (essidlen != 14)
    return;
  if (memcmp(essid, cabovisao, 10) != 0)
    return;
  if ((!isxdigit(essid[10])) || (!isxdigit(essid[11])) ||
      (!isxdigit(essid[12])) || (!isxdigit(essid[13])))
    return;
  for (k1 = 0; k1 < 0x100; k1++) {
    snprintf(essidtmp, 64, "2ce412%02x%c%c%c%c", k1, essid[10], essid[11],
             essid[12], essid[13]);
    writepsk(fhout, essidtmp);
    snprintf(essidtmp, 64, "e0ca94%02x%c%c%c%c", k1, essid[10], essid[11],
             essid[12], essid[13]);
    writepsk(fhout, essidtmp);
    snprintf(essidtmp, 64, "e0cec3%02x%c%c%c%c", k1, essid[10], essid[11],
             essid[12], essid[13]);
    writepsk(fhout, essidtmp);
  }
  return;
}


x86 assembly (clang, -O0):
<testcabovisao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xe,-0xc(%rbp)
je     1162 <testcabovisao+0x22>
jmp    1311 <testcabovisao+0x1d1>
mov    -0x18(%rbp),%rdi
mov    0x2ed3(%rip),%rsi
mov    $0xa,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     1186 <testcabovisao+0x46>
jmp    1311 <testcabovisao+0x1d1>
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%edi
call   1060 <isxdigit@plt>
cmp    $0x0,%eax
je     11da <testcabovisao+0x9a>
mov    -0x18(%rbp),%rax
mov    0x2c(%rax),%edi
call   1060 <isxdigit@plt>
cmp    $0x0,%eax
je     11da <testcabovisao+0x9a>
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%edi
call   1060 <isxdigit@plt>
cmp    $0x0,%eax
je     11da <testcabovisao+0x9a>
mov    -0x18(%rbp),%rax
mov    0x34(%rax),%edi
call   1060 <isxdigit@plt>
cmp    $0x0,%eax
jne    11df <testcabovisao+0x9f>
jmp    1311 <testcabovisao+0x1d1>
movl   $0x0,0x2e77(%rip)
cmpl   $0x100,0x2e6d(%rip)
jge    130c <testcabovisao+0x1cc>
mov    0x2e61(%rip),%ecx
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x2c(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%r10d
mov    -0x18(%rbp),%rax
mov    0x34(%rax),%eax
lea    0x2e4b(%rip),%rdi
mov    $0x40,%esi
lea    0xdda(%rip),%rdx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x2e27(%rip),%rsi
call   1040 <writepsk@plt>
mov    0x2e0c(%rip),%ecx
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x2c(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%r10d
mov    -0x18(%rbp),%rax
mov    0x34(%rax),%eax
lea    0x2df6(%rip),%rdi
mov    $0x40,%esi
lea    0xd98(%rip),%rdx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x2dd2(%rip),%rsi
call   1040 <writepsk@plt>
mov    0x2db7(%rip),%ecx
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x2c(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%r10d
mov    -0x18(%rbp),%rax
mov    0x34(%rax),%eax
lea    0x2da1(%rip),%rdi
mov    $0x40,%esi
lea    0xd56(%rip),%rdx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x2d7d(%rip),%rsi
call   1040 <writepsk@plt>
mov    0x2d62(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2d59(%rip)
jmp    11e9 <testcabovisao+0xa9>
jmp    1311 <testcabovisao+0x1d1>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testcabovisao>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
cmp    $0xe,%esi
jne    1170 <testcabovisao+0x30>
mov    %rdx,%rbx
lea    0xea2(%rip),%rsi
mov    %rdx,%rdi
mov    $0xa,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     117f <testcabovisao+0x3f>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x28(%rbx),%r12d
mov    %r12d,%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     1170 <testcabovisao+0x30>
mov    0x2c(%rbx),%r13d
mov    %r13d,%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     1170 <testcabovisao+0x30>
mov    0x30(%rbx),%ebp
mov    %ebp,%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     1170 <testcabovisao+0x30>
mov    0x34(%rbx),%r14d
mov    %r14d,%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     1170 <testcabovisao+0x30>
movl   $0x0,0x2e89(%rip)
xor    %ecx,%ecx
lea    0x2e90(%rip),%r15
mov    %r15,%rdi
mov    $0x40,%esi
lea    0xe2c(%rip),%rdx
mov    %r12d,%r8d
mov    %r13d,%r9d
push   %r14
push   %rbp
call   1030 <snprintf@plt>
add    $0x10,%rsp
mov    (%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <writepsk@plt>
mov    0x2e4a(%rip),%ecx
mov    0x28(%rbx),%r8d
mov    0x2c(%rbx),%r9d
mov    0x30(%rbx),%eax
mov    0x34(%rbx),%ebp
mov    %r15,%rdi
mov    $0x40,%esi
lea    0xdfb(%rip),%rdx
push   %rbp
push   %rax
call   1030 <snprintf@plt>
add    $0x10,%rsp
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <writepsk@plt>
mov    0x2e11(%rip),%ecx
mov    0x28(%rbx),%r8d
mov    0x2c(%rbx),%r9d
mov    0x30(%rbx),%eax
mov    0x34(%rbx),%ebp
mov    %r15,%rdi
mov    $0x40,%esi
lea    0xdd5(%rip),%rdx
push   %rbp
push   %rax
call   1030 <snprintf@plt>
add    $0x10,%rsp
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <writepsk@plt>
mov    0x2dd8(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2dcf(%rip)
cmp    $0xfe,%eax
jg     1170 <testcabovisao+0x30>
mov    0x28(%rbx),%r12d
mov    0x2c(%rbx),%r13d
mov    0x30(%rbx),%ebp
mov    0x34(%rbx),%r14d
jmp    11d0 <testcabovisao+0x90>

LLVM IR (-O0):
@testcabovisao.k1 = internal global i32 0
@testcabovisao.cabovisao = internal global i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0)
@.str = [11 x i8] c"Cabovisao-\00"
@testcabovisao.essidtmp = internal global [64 x i8] zeroinitializer
@.str.1 = [19 x i8] c"2ce412%02x%c%c%c%c\00"
@.str.2 = [19 x i8] c"e0ca94%02x%c%c%c%c\00"
@.str.3 = [19 x i8] c"e0cec3%02x%c%c%c%c\00"
define void @testcabovisao(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 14
br i1 %8, label %9, label %10
9: ; preds = %3
br label %98
10: ; preds = %3
%11 = load i32*, i32** %6
%12 = load i8*, i8** @testcabovisao.cabovisao
%13 = call i64 @memcmp(i32* %11, i8* %12, i32 10)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %10
br label %98
16: ; preds = %10
%17 = load i32*, i32** %6
%18 = getelementptr inbounds i32, i32* %17, i64 10
%19 = load i32, i32* %18
%20 = call i32 @isxdigit(i32 %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %40
22: ; preds = %16
%23 = load i32*, i32** %6
%24 = getelementptr inbounds i32, i32* %23, i64 11
%25 = load i32, i32* %24
%26 = call i32 @isxdigit(i32 %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %40
28: ; preds = %22
%29 = load i32*, i32** %6
%30 = getelementptr inbounds i32, i32* %29, i64 12
%31 = load i32, i32* %30
%32 = call i32 @isxdigit(i32 %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %28
%35 = load i32*, i32** %6
%36 = getelementptr inbounds i32, i32* %35, i64 13
%37 = load i32, i32* %36
%38 = call i32 @isxdigit(i32 %37)
%39 = icmp ne i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %34, %28, %22, %16
br label %98
41: ; preds = %34
store i32 0, i32* @testcabovisao.k1
br label %42
42: ; preds = %94, %41
%43 = load i32, i32* @testcabovisao.k1
%44 = icmp slt i32 %43, 256
br i1 %44, label %45, label %97
45: ; preds = %42
%46 = load i32, i32* @testcabovisao.k1
%47 = load i32*, i32** %6
%48 = getelementptr inbounds i32, i32* %47, i64 10
%49 = load i32, i32* %48
%50 = load i32*, i32** %6
%51 = getelementptr inbounds i32, i32* %50, i64 11
%52 = load i32, i32* %51
%53 = load i32*, i32** %6
%54 = getelementptr inbounds i32, i32* %53, i64 12
%55 = load i32, i32* %54
%56 = load i32*, i32** %6
%57 = getelementptr inbounds i32, i32* %56, i64 13
%58 = load i32, i32* %57
%59 = call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %46, i32 %49, i32 %52, i32 %55, i32 %58)
%60 = load i32*, i32** %4
%61 = call i32 @writepsk(i32* %60, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0))
%62 = load i32, i32* @testcabovisao.k1
%63 = load i32*, i32** %6
%64 = getelementptr inbounds i32, i32* %63, i64 10
%65 = load i32, i32* %64
%66 = load i32*, i32** %6
%67 = getelementptr inbounds i32, i32* %66, i64 11
%68 = load i32, i32* %67
%69 = load i32*, i32** %6
%70 = getelementptr inbounds i32, i32* %69, i64 12
%71 = load i32, i32* %70
%72 = load i32*, i32** %6
%73 = getelementptr inbounds i32, i32* %72, i64 13
%74 = load i32, i32* %73
%75 = call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %62, i32 %65, i32 %68, i32 %71, i32 %74)
%76 = load i32*, i32** %4
%77 = call i32 @writepsk(i32* %76, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0))
%78 = load i32, i32* @testcabovisao.k1
%79 = load i32*, i32** %6
%80 = getelementptr inbounds i32, i32* %79, i64 10
%81 = load i32, i32* %80
%82 = load i32*, i32** %6
%83 = getelementptr inbounds i32, i32* %82, i64 11
%84 = load i32, i32* %83
%85 = load i32*, i32** %6
%86 = getelementptr inbounds i32, i32* %85, i64 12
%87 = load i32, i32* %86
%88 = load i32*, i32** %6
%89 = getelementptr inbounds i32, i32* %88, i64 13
%90 = load i32, i32* %89
%91 = call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %78, i32 %81, i32 %84, i32 %87, i32 %90)
%92 = load i32*, i32** %4
%93 = call i32 @writepsk(i32* %92, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0))
br label %94
94: ; preds = %45
%95 = load i32, i32* @testcabovisao.k1
%96 = add nsw i32 %95, 1
store i32 %96, i32* @testcabovisao.k1
br label %42
97: ; preds = %42
br label %98
98: ; preds = %97, %40, %15, %9
ret void
}

LLVM IR (-O2):
@testcabovisao.k1 = internal unnamed_addr global i32 0
@.str = [11 x i8] c"Cabovisao-\00"
@testcabovisao.essidtmp = internal global [64 x i8] zeroinitializer
@.str.1 = [19 x i8] c"2ce412%02x%c%c%c%c\00"
@.str.2 = [19 x i8] c"e0ca94%02x%c%c%c%c\00"
@.str.3 = [19 x i8] c"e0cec3%02x%c%c%c%c\00"
define void @testcabovisao(i32* %0, i32 %1, i32* %2) {
%4 = icmp eq i32 %1, 14
br i1 %4, label %5, label %59
5: ; preds = %3
%6 = tail call i64 @memcmp(i32* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 10)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %59
8: ; preds = %5
%9 = getelementptr inbounds i32, i32* %2, i64 10
%10 = load i32, i32* %9
%11 = tail call i32 @isxdigit(i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %59, label %13
13: ; preds = %8
%14 = getelementptr inbounds i32, i32* %2, i64 11
%15 = load i32, i32* %14
%16 = tail call i32 @isxdigit(i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %59, label %18
18: ; preds = %13
%19 = getelementptr inbounds i32, i32* %2, i64 12
%20 = load i32, i32* %19
%21 = tail call i32 @isxdigit(i32 %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %59, label %23
23: ; preds = %18
%24 = getelementptr inbounds i32, i32* %2, i64 13
%25 = load i32, i32* %24
%26 = tail call i32 @isxdigit(i32 %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %59, label %28
28: ; preds = %23
store i32 0, i32* @testcabovisao.k1
br label %29
29: ; preds = %54, %28
%30 = phi i32 [ %25, %28 ], [ %58, %54 ]
%31 = phi i32 [ %20, %28 ], [ %57, %54 ]
%32 = phi i32 [ %15, %28 ], [ %56, %54 ]
%33 = phi i32 [ %10, %28 ], [ %55, %54 ]
%34 = phi i32 [ 0, %28 ], [ %52, %54 ]
%35 = tail call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %33, i32 %32, i32 %31, i32 %30)
%36 = tail call i32 @writepsk(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0))
%37 = load i32, i32* @testcabovisao.k1
%38 = load i32, i32* %9
%39 = load i32, i32* %14
%40 = load i32, i32* %19
%41 = load i32, i32* %24
%42 = tail call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %38, i32 %39, i32 %40, i32 %41)
%43 = tail call i32 @writepsk(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0))
%44 = load i32, i32* @testcabovisao.k1
%45 = load i32, i32* %9
%46 = load i32, i32* %14
%47 = load i32, i32* %19
%48 = load i32, i32* %24
%49 = tail call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %44, i32 %45, i32 %46, i32 %47, i32 %48)
%50 = tail call i32 @writepsk(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @testcabovisao.essidtmp, i64 0, i64 0))
%51 = load i32, i32* @testcabovisao.k1
%52 = add nsw i32 %51, 1
store i32 %52, i32* @testcabovisao.k1
%53 = icmp slt i32 %51, 255
br i1 %53, label %54, label %59
54: ; preds = %29
%55 = load i32, i32* %9
%56 = load i32, i32* %14
%57 = load i32, i32* %19
%58 = load i32, i32* %24
br label %29
59: ; preds = %29, %8, %13, %18, %23, %5, %3
ret void
}