#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 /*<<< orphan*/ isdigit(int);
scalar_t__ memcmp(int *, char const *, int);
int strtol(char *, int /*<<< orphan*/ *, int);
void testroamingman(FILE *fhout, uint8_t essidlen, uint8_t *essid) {
  static int k1, k2, k3;
  static char *ev;
  static const char *roamingman = "Roamingman_";
  if (essidlen != 16)
    return;
  if ((!isdigit(essid[11])) || (!isdigit(essid[12])) || (!isdigit(essid[13])) ||
      (!isdigit(essid[14])) || (!isdigit(essid[15])))
    return;
  if (memcmp(essid, roamingman, 11) != 0)
    return;
  ev = (char *)(essid + 11);
  k2 = strtol(ev, NULL, 10);
  for (k3 = k2 - 10; k3 < k2 + 10; k3++) {
    for (k1 = 0; k1 < 1000; k1++) {
      if (k3 < 0)
        fprintf(fhout, "%03d%05d\n", k1, k3 + 100000);
      else if (k3 > 99999)
        fprintf(fhout, "%03d%05d\n", k1, k3 - 100000);
      else
        fprintf(fhout, "%03d%05d\n", k1, k3);
    }
  }
  return;
}


x86 assembly (clang, -O0):
<testroamingman>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x10,-0xc(%rbp)
je     1162 <testroamingman+0x22>
jmp    1321 <testroamingman+0x1e1>
mov    -0x18(%rbp),%rax
mov    0x2c(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     11cb <testroamingman+0x8b>
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     11cb <testroamingman+0x8b>
mov    -0x18(%rbp),%rax
mov    0x34(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     11cb <testroamingman+0x8b>
mov    -0x18(%rbp),%rax
mov    0x38(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     11cb <testroamingman+0x8b>
mov    -0x18(%rbp),%rax
mov    0x3c(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11d0 <testroamingman+0x90>
jmp    1321 <testroamingman+0x1e1>
mov    -0x18(%rbp),%rdi
mov    0x2e65(%rip),%rsi
mov    $0xb,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     11f4 <testroamingman+0xb4>
jmp    1321 <testroamingman+0x1e1>
mov    -0x18(%rbp),%rax
add    $0x2c,%rax
mov    %rax,0x2e5d(%rip)
mov    0x2e56(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,0x2e36(%rip)
mov    0x2e30(%rip),%eax
sub    $0xa,%eax
mov    %eax,0x2e2b(%rip)
mov    0x2e25(%rip),%eax
mov    0x2e1b(%rip),%ecx
add    $0xa,%ecx
cmp    %ecx,%eax
jge    131c <testroamingman+0x1dc>
movl   $0x0,0x2e02(%rip)
cmpl   $0x3e8,0x2df8(%rip)
jge    1303 <testroamingman+0x1c3>
cmpl   $0x0,0x2df3(%rip)
jge    1292 <testroamingman+0x152>
mov    -0x8(%rbp),%rdi
mov    0x2ddb(%rip),%edx
mov    0x2ddd(%rip),%ecx
add    $0x186a0,%ecx
lea    0xd84(%rip),%rsi
call   1050 <fprintf@plt>
jmp    12ea <testroamingman+0x1aa>
cmpl   $0x1869f,0x2dbc(%rip)
jle    12c9 <testroamingman+0x189>
mov    -0x8(%rbp),%rdi
mov    0x2da4(%rip),%edx
mov    0x2da6(%rip),%ecx
sub    $0x186a0,%ecx
lea    0xd4d(%rip),%rsi
call   1050 <fprintf@plt>
jmp    12e5 <testroamingman+0x1a5>
mov    -0x8(%rbp),%rdi
mov    0x2d7d(%rip),%edx
mov    0x2d7f(%rip),%ecx
lea    0xd2c(%rip),%rsi
call   1050 <fprintf@plt>
jmp    12ea <testroamingman+0x1aa>
jmp    12ef <testroamingman+0x1af>
mov    0x2d5b(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2d52(%rip)
jmp    124e <testroamingman+0x10e>
jmp    1308 <testroamingman+0x1c8>
mov    0x2d4a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2d41(%rip)
jmp    122d <testroamingman+0xed>
jmp    1321 <testroamingman+0x1e1>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testroamingman>:
push   %r14
push   %rbx
push   %rax
cmp    $0x10,%esi
jne    1249 <testroamingman+0x119>
mov    %rdx,%r14
mov    0x2c(%rdx),%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1249 <testroamingman+0x119>
mov    0x30(%r14),%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1249 <testroamingman+0x119>
mov    0x34(%r14),%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1249 <testroamingman+0x119>
mov    0x38(%r14),%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1249 <testroamingman+0x119>
mov    0x3c(%r14),%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1249 <testroamingman+0x119>
mov    %rdi,%rbx
lea    0xe67(%rip),%rsi
mov    %r14,%rdi
mov    $0xb,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jne    1249 <testroamingman+0x119>
add    $0x2c,%r14
mov    %r14,0x2e96(%rip)
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,0x2e75(%rip)
add    $0xfffffff6,%eax
mov    %eax,0x2e70(%rip)
lea    0xe2d(%rip),%r14
movl   $0x0,0x2e57(%rip)
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
lea    -0x186a0(%rax),%ecx
cmp    $0x186a0,%eax
cmovb  %eax,%ecx
lea    0x186a0(%rax),%esi
test   %eax,%eax
cmovs  %esi,%ecx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    0x2e26(%rip),%ecx
lea    0x1(%rcx),%edx
mov    %edx,0x2e1d(%rip)
mov    0x2e1f(%rip),%eax
cmp    $0x3e7,%ecx
jl     11f0 <testroamingman+0xc0>
lea    0x1(%rax),%ecx
mov    %ecx,0x2e0e(%rip)
mov    0x2e04(%rip),%edx
add    $0x9,%edx
cmp    %edx,%eax
mov    %ecx,%eax
jl     11df <testroamingman+0xaf>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@testroamingman.k1 = internal global i32 0
@testroamingman.k2 = internal global i32 0
@testroamingman.k3 = internal global i32 0
@testroamingman.ev = internal global i8* null
@testroamingman.roamingman = internal global i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0)
@.str = [12 x i8] c"Roamingman_\00"
@.str.1 = [10 x i8] c"%03d%05d\0A\00"
define void @testroamingman(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, 16
br i1 %8, label %9, label %10
9: ; preds = %3
br label %97
10: ; preds = %3
%11 = load i32*, i32** %6
%12 = getelementptr inbounds i32, i32* %11, i64 11
%13 = load i32, i32* %12
%14 = call i32 @isdigit(i32 %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %40
16: ; preds = %10
%17 = load i32*, i32** %6
%18 = getelementptr inbounds i32, i32* %17, i64 12
%19 = load i32, i32* %18
%20 = call i32 @isdigit(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 13
%25 = load i32, i32* %24
%26 = call i32 @isdigit(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 14
%31 = load i32, i32* %30
%32 = call i32 @isdigit(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 15
%37 = load i32, i32* %36
%38 = call i32 @isdigit(i32 %37)
%39 = icmp ne i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %34, %28, %22, %16, %10
br label %97
41: ; preds = %34
%42 = load i32*, i32** %6
%43 = load i8*, i8** @testroamingman.roamingman
%44 = call i64 @memcmp(i32* %42, i8* %43, i32 11)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %41
br label %97
47: ; preds = %41
%48 = load i32*, i32** %6
%49 = getelementptr inbounds i32, i32* %48, i64 11
%50 = bitcast i32* %49 to i8*
store i8* %50, i8** @testroamingman.ev
%51 = load i8*, i8** @testroamingman.ev
%52 = call i32 @strtol(i8* %51, i32* null, i32 10)
store i32 %52, i32* @testroamingman.k2
%53 = load i32, i32* @testroamingman.k2
%54 = sub nsw i32 %53, 10
store i32 %54, i32* @testroamingman.k3
br label %55
55: ; preds = %93, %47
%56 = load i32, i32* @testroamingman.k3
%57 = load i32, i32* @testroamingman.k2
%58 = add nsw i32 %57, 10
%59 = icmp slt i32 %56, %58
br i1 %59, label %60, label %96
60: ; preds = %55
store i32 0, i32* @testroamingman.k1
br label %61
61: ; preds = %89, %60
%62 = load i32, i32* @testroamingman.k1
%63 = icmp slt i32 %62, 1000
br i1 %63, label %64, label %92
64: ; preds = %61
%65 = load i32, i32* @testroamingman.k3
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %73
67: ; preds = %64
%68 = load i32*, i32** %4
%69 = load i32, i32* @testroamingman.k1
%70 = load i32, i32* @testroamingman.k3
%71 = add nsw i32 %70, 100000
%72 = call i32 @fprintf(i32* %68, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %69, i32 %71)
br label %88
73: ; preds = %64
%74 = load i32, i32* @testroamingman.k3
%75 = icmp sgt i32 %74, 99999
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = load i32*, i32** %4
%78 = load i32, i32* @testroamingman.k1
%79 = load i32, i32* @testroamingman.k3
%80 = sub nsw i32 %79, 100000
%81 = call i32 @fprintf(i32* %77, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %78, i32 %80)
br label %87
82: ; preds = %73
%83 = load i32*, i32** %4
%84 = load i32, i32* @testroamingman.k1
%85 = load i32, i32* @testroamingman.k3
%86 = call i32 @fprintf(i32* %83, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %84, i32 %85)
br label %87
87: ; preds = %82, %76
br label %88
88: ; preds = %87, %67
br label %89
89: ; preds = %88
%90 = load i32, i32* @testroamingman.k1
%91 = add nsw i32 %90, 1
store i32 %91, i32* @testroamingman.k1
br label %61
92: ; preds = %61
br label %93
93: ; preds = %92
%94 = load i32, i32* @testroamingman.k3
%95 = add nsw i32 %94, 1
store i32 %95, i32* @testroamingman.k3
br label %55
96: ; preds = %55
br label %97
97: ; preds = %96, %46, %40, %9
ret void
}

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