#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, int, int, int);
int /*<<< orphan*/ isdigit(int);
scalar_t__ memcmp(int *, char const *, int);
void testglocal(FILE *fhout, uint8_t essidlen, uint8_t *essid) {
  static int k1, k2, k3, k4;
  static const char *glocalme = "GlocalMe_";
  if (essidlen != 14)
    return;
  if (memcmp(essid, glocalme, 9) != 0)
    return;
  if ((!isdigit(essid[9])) || (!isdigit(essid[10])) || (!isdigit(essid[11])) ||
      (!isdigit(essid[12])) || (!isdigit(essid[13])))
    return;
  k2 = essid[11];
  k3 = essid[12];
  for (k1 = 0; k1 < 100000; k1++) {
    for (k4 = 0; k4 < 10; k4++)
      fprintf(fhout, "%05d%c%c%d\n", k1, k2, k3, k4);
  }
  return;
}


x86 assembly (clang, -O0):
<testglocal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xe,-0xc(%rbp)
je     1152 <testglocal+0x22>
jmp    128b <testglocal+0x15b>
mov    -0x18(%rbp),%rdi
mov    0x2edb(%rip),%rsi
mov    $0x9,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     1176 <testglocal+0x46>
jmp    128b <testglocal+0x15b>
mov    -0x18(%rbp),%rax
mov    0x24(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     11df <testglocal+0xaf>
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     11df <testglocal+0xaf>
mov    -0x18(%rbp),%rax
mov    0x2c(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     11df <testglocal+0xaf>
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     11df <testglocal+0xaf>
mov    -0x18(%rbp),%rax
mov    0x34(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11e4 <testglocal+0xb4>
jmp    128b <testglocal+0x15b>
mov    -0x18(%rbp),%rax
mov    0x2c(%rax),%eax
mov    %eax,0x2e57(%rip)
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%eax
mov    %eax,0x2e4e(%rip)
movl   $0x0,0x2e3c(%rip)
cmpl   $0x186a0,0x2e32(%rip)
jge    1286 <testglocal+0x156>
movl   $0x0,0x2e2e(%rip)
cmpl   $0xa,0x2e27(%rip)
jge    126d <testglocal+0x13d>
mov    -0x8(%rbp),%rdi
mov    0x2e0b(%rip),%edx
mov    0x2e09(%rip),%ecx
mov    0x2e06(%rip),%r8d
mov    0x2e03(%rip),%r9d
lea    0xdb6(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2df1(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2de8(%rip)
jmp    1222 <testglocal+0xf2>
jmp    1272 <testglocal+0x142>
mov    0x2dcc(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2dc3(%rip)
jmp    1208 <testglocal+0xd8>
jmp    128b <testglocal+0x15b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testglocal>:
push   %r14
push   %rbx
push   %rax
cmp    $0xe,%esi
jne    1217 <testglocal+0xf7>
mov    %rdx,%r14
mov    %rdi,%rbx
lea    0xec6(%rip),%rsi
mov    %rdx,%rdi
mov    $0x9,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jne    1217 <testglocal+0xf7>
mov    0x24(%r14),%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1217 <testglocal+0xf7>
mov    0x28(%r14),%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1217 <testglocal+0xf7>
mov    0x2c(%r14),%eax
lea    -0x30(%rax),%ecx
cmp    $0x9,%ecx
ja     1217 <testglocal+0xf7>
mov    0x30(%r14),%ecx
lea    -0x30(%rcx),%edx
cmp    $0x9,%edx
ja     1217 <testglocal+0xf7>
mov    0x34(%r14),%edx
add    $0xffffffd0,%edx
cmp    $0x9,%edx
ja     1217 <testglocal+0xf7>
mov    %eax,0x2e96(%rip)
mov    %ecx,0x2e94(%rip)
movl   $0x0,0x2e82(%rip)
xor    %edx,%edx
lea    0xe4f(%rip),%r14
movl   $0x0,0x2e7b(%rip)
xor    %r9d,%r9d
nopl   0x0(%rax,%rax,1)
mov    0x2e62(%rip),%ecx
mov    0x2e5f(%rip),%r8d
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    0x2e52(%rip),%eax
lea    0x1(%rax),%r9d
mov    %r9d,0x2e47(%rip)
mov    0x2e35(%rip),%edx
cmp    $0x9,%eax
jl     11d0 <testglocal+0xb0>
lea    0x1(%rdx),%eax
mov    %eax,0x2e27(%rip)
cmp    $0x1869f,%edx
mov    %eax,%edx
jl     11bb <testglocal+0x9b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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