#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*/ fprintf(int /*<<< orphan*/ *, char *, int);
scalar_t__ isxdigit(int);
scalar_t__ memcmp(int *, char const *, int);
void testrtk(FILE *fhout, uint8_t essidlen, uint8_t *essid) {
  static int k1;
  static const char *rtk = "RTK-";
  if (essidlen == 10) {
    if ((isxdigit(essid[4])) && (isxdigit(essid[5])) && (isxdigit(essid[6])) &&
        (isxdigit(essid[7])) && (isxdigit(essid[8])) && (isxdigit(essid[9]))) {
      if (memcmp(essid, rtk, 4) == 0) {
        for (k1 = 0; k1 < 0x100000; k1++) {
          fprintf(fhout, "454C54585C0%05X\n", k1);
          fprintf(fhout, "454C54585C1%05X\n", k1);
          fprintf(fhout, "53434F4D1A0%05X\n", k1);
          fprintf(fhout, "ELTX1A0%05X\n", k1);
          fprintf(fhout, "ELTX5C0%05X\n", k1);
        }
      }
      return;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<testrtk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    129b <testrtk+0x16b>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%rax
je     1296 <testrtk+0x166>
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%rax
je     1296 <testrtk+0x166>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%rax
je     1296 <testrtk+0x166>
mov    -0x18(%rbp),%rax
mov    0x1c(%rax),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%rax
je     1296 <testrtk+0x166>
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%rax
je     1296 <testrtk+0x166>
mov    -0x18(%rbp),%rax
mov    0x24(%rax),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%rax
je     1296 <testrtk+0x166>
mov    -0x18(%rbp),%rdi
mov    0x2e5c(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jne    1291 <testrtk+0x161>
movl   $0x0,0x2e4a(%rip)
cmpl   $0x100000,0x2e40(%rip)
jge    128c <testrtk+0x15c>
mov    -0x8(%rbp),%rdi
mov    0x2e30(%rip),%edx
lea    0xdea(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e1a(%rip),%edx
lea    0xde5(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e04(%rip),%edx
lea    0xde0(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2dee(%rip),%edx
lea    0xddb(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2dd8(%rip),%edx
lea    0xdd2(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dc6(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2dbd(%rip)
jmp    11fa <testrtk+0xca>
jmp    1291 <testrtk+0x161>
jmp    12a0 <testrtk+0x170>
jmp    129b <testrtk+0x16b>
jmp    12a0 <testrtk+0x170>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testrtk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0xa,%esi
jne    1265 <testrtk+0x135>
mov    %rdx,%rbx
mov    %rdi,%r14
mov    0x10(%rdx),%edi
call   1050 <isxdigit@plt>
test   %rax,%rax
je     1265 <testrtk+0x135>
mov    0x14(%rbx),%edi
call   1050 <isxdigit@plt>
test   %rax,%rax
je     1265 <testrtk+0x135>
mov    0x18(%rbx),%edi
call   1050 <isxdigit@plt>
test   %rax,%rax
je     1265 <testrtk+0x135>
mov    0x1c(%rbx),%edi
call   1050 <isxdigit@plt>
test   %rax,%rax
je     1265 <testrtk+0x135>
mov    0x20(%rbx),%edi
call   1050 <isxdigit@plt>
test   %rax,%rax
je     1265 <testrtk+0x135>
mov    0x24(%rbx),%edi
call   1050 <isxdigit@plt>
test   %rax,%rax
je     1265 <testrtk+0x135>
lea    0xe49(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jne    1265 <testrtk+0x135>
movl   $0x0,0x2e65(%rip)
xor    %edx,%edx
lea    0xe25(%rip),%r15
lea    0xe2f(%rip),%r12
lea    0xe39(%rip),%r13
lea    0xe43(%rip),%rbx
lea    0xe49(%rip),%rbp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fprintf@plt>
mov    0x2e2b(%rip),%edx
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <fprintf@plt>
mov    0x2e1a(%rip),%edx
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <fprintf@plt>
mov    0x2e09(%rip),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    0x2df8(%rip),%edx
mov    %r14,%rdi
mov    %rbp,%rsi
call   1040 <fprintf@plt>
mov    0x2de7(%rip),%eax
lea    0x1(%rax),%edx
mov    %edx,0x2dde(%rip)
cmp    $0xfffff,%eax
jl     1200 <testrtk+0xd0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@testrtk.k1 = internal global i32 0
@testrtk.rtk = internal global i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0)
@.str = [5 x i8] c"RTK-\00"
@.str.1 = [17 x i8] c"454C54585C0%05X\0A\00"
@.str.2 = [17 x i8] c"454C54585C1%05X\0A\00"
@.str.3 = [17 x i8] c"53434F4D1A0%05X\0A\00"
@.str.4 = [13 x i8] c"ELTX1A0%05X\0A\00"
@.str.5 = [13 x i8] c"ELTX5C0%05X\0A\00"
define void @testrtk(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 eq i32 %7, 10
br i1 %8, label %9, label %76
9: ; preds = %3
%10 = load i32*, i32** %6
%11 = getelementptr inbounds i32, i32* %10, i64 4
%12 = load i32, i32* %11
%13 = call i64 @isxdigit(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %75
15: ; preds = %9
%16 = load i32*, i32** %6
%17 = getelementptr inbounds i32, i32* %16, i64 5
%18 = load i32, i32* %17
%19 = call i64 @isxdigit(i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %75
21: ; preds = %15
%22 = load i32*, i32** %6
%23 = getelementptr inbounds i32, i32* %22, i64 6
%24 = load i32, i32* %23
%25 = call i64 @isxdigit(i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %75
27: ; preds = %21
%28 = load i32*, i32** %6
%29 = getelementptr inbounds i32, i32* %28, i64 7
%30 = load i32, i32* %29
%31 = call i64 @isxdigit(i32 %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %75
33: ; preds = %27
%34 = load i32*, i32** %6
%35 = getelementptr inbounds i32, i32* %34, i64 8
%36 = load i32, i32* %35
%37 = call i64 @isxdigit(i32 %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %75
39: ; preds = %33
%40 = load i32*, i32** %6
%41 = getelementptr inbounds i32, i32* %40, i64 9
%42 = load i32, i32* %41
%43 = call i64 @isxdigit(i32 %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %75
45: ; preds = %39
%46 = load i32*, i32** %6
%47 = load i8*, i8** @testrtk.rtk
%48 = call i64 @memcmp(i32* %46, i8* %47, i32 4)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %74
50: ; preds = %45
store i32 0, i32* @testrtk.k1
br label %51
51: ; preds = %70, %50
%52 = load i32, i32* @testrtk.k1
%53 = icmp slt i32 %52, 1048576
br i1 %53, label %54, label %73
54: ; preds = %51
%55 = load i32*, i32** %4
%56 = load i32, i32* @testrtk.k1
%57 = call i32 @fprintf(i32* %55, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = load i32*, i32** %4
%59 = load i32, i32* @testrtk.k1
%60 = call i32 @fprintf(i32* %58, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = load i32*, i32** %4
%62 = load i32, i32* @testrtk.k1
%63 = call i32 @fprintf(i32* %61, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %62)
%64 = load i32*, i32** %4
%65 = load i32, i32* @testrtk.k1
%66 = call i32 @fprintf(i32* %64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %65)
%67 = load i32*, i32** %4
%68 = load i32, i32* @testrtk.k1
%69 = call i32 @fprintf(i32* %67, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %68)
br label %70
70: ; preds = %54
%71 = load i32, i32* @testrtk.k1
%72 = add nsw i32 %71, 1
store i32 %72, i32* @testrtk.k1
br label %51
73: ; preds = %51
br label %74
74: ; preds = %73, %45
br label %77
75: ; preds = %39, %33, %27, %21, %15, %9
br label %76
76: ; preds = %75, %3
br label %77
77: ; preds = %76, %74
ret void
}

LLVM IR (-O2):
@testrtk.k1 = internal unnamed_addr global i32 0
@.str = [5 x i8] c"RTK-\00"
@.str.1 = [17 x i8] c"454C54585C0%05X\0A\00"
@.str.2 = [17 x i8] c"454C54585C1%05X\0A\00"
@.str.3 = [17 x i8] c"53434F4D1A0%05X\0A\00"
@.str.4 = [13 x i8] c"ELTX1A0%05X\0A\00"
@.str.5 = [13 x i8] c"ELTX5C0%05X\0A\00"
define void @testrtk(i32* nocapture %0, i32 %1, i32* %2) {
%4 = icmp eq i32 %1, 10
br i1 %4, label %5, label %53
5: ; preds = %3
%6 = getelementptr inbounds i32, i32* %2, i64 4
%7 = load i32, i32* %6
%8 = tail call i64 @isxdigit(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %53, label %10
10: ; preds = %5
%11 = getelementptr inbounds i32, i32* %2, i64 5
%12 = load i32, i32* %11
%13 = tail call i64 @isxdigit(i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %53, label %15
15: ; preds = %10
%16 = getelementptr inbounds i32, i32* %2, i64 6
%17 = load i32, i32* %16
%18 = tail call i64 @isxdigit(i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %53, label %20
20: ; preds = %15
%21 = getelementptr inbounds i32, i32* %2, i64 7
%22 = load i32, i32* %21
%23 = tail call i64 @isxdigit(i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %53, label %25
25: ; preds = %20
%26 = getelementptr inbounds i32, i32* %2, i64 8
%27 = load i32, i32* %26
%28 = tail call i64 @isxdigit(i32 %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %53, label %30
30: ; preds = %25
%31 = getelementptr inbounds i32, i32* %2, i64 9
%32 = load i32, i32* %31
%33 = tail call i64 @isxdigit(i32 %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %53, label %35
35: ; preds = %30
%36 = tail call i64 @memcmp(i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %53
38: ; preds = %35
store i32 0, i32* @testrtk.k1
br label %39
39: ; preds = %38, %39
%40 = phi i32 [ 0, %38 ], [ %51, %39 ]
%41 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* @testrtk.k1
%43 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%44 = load i32, i32* @testrtk.k1
%45 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %44)
%46 = load i32, i32* @testrtk.k1
%47 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %46)
%48 = load i32, i32* @testrtk.k1
%49 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %48)
%50 = load i32, i32* @testrtk.k1
%51 = add nsw i32 %50, 1
store i32 %51, i32* @testrtk.k1
%52 = icmp slt i32 %50, 1048575
br i1 %52, label %39, label %53
53: ; preds = %39, %3, %30, %25, %20, %15, %10, %5, %35
ret void
}