#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*/ memset(char **, int /*<<< orphan*/, int);
int /*<<< orphan*/ writeessidadd(int /*<<< orphan*/ *, char *);
bool writeessidremoved(FILE *fhout, uint8_t essidlen, uint8_t *essid) {
  static int pi;
  static int po;
  static int essidlentmp;
  static bool removeflag;
  static char essidtmp[64] = {};
  po = 0;
  removeflag = false;
  essidlentmp = essidlen;
  memset(&essidtmp, 0, 64);
  for (pi = 0; pi < essidlen; pi++) {
    if (((essid[pi] >= 'A') && (essid[pi] <= 'Z')) ||
        ((essid[pi] >= 'a') && (essid[pi] <= 'z'))) {
      essidtmp[po] = essid[pi];
      po++;
    } else {
      essidlentmp--;
      removeflag = true;
    }
  }
  writeessidadd(fhout, (char *)essid);
  if (removeflag == true)
    writeessidadd(fhout, essidtmp);
  return removeflag;
}


x86 assembly (clang, -O0):
<writeessidremoved>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,0x2f07(%rip)
movl   $0x0,0x2f05(%rip)
mov    -0xc(%rbp),%eax
mov    %eax,0x2ef8(%rip)
lea    0x2ef9(%rip),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
movl   $0x0,0x2ed3(%rip)
mov    0x2ecd(%rip),%eax
cmp    -0xc(%rbp),%eax
jge    1237 <writeessidremoved+0x117>
mov    -0x18(%rbp),%rax
movslq 0x2eb9(%rip),%rcx
cmpl   $0x41,(%rax,%rcx,4)
jl     11a6 <writeessidremoved+0x86>
mov    -0x18(%rbp),%rax
movslq 0x2ea4(%rip),%rcx
cmpl   $0x5a,(%rax,%rcx,4)
jle    11d0 <writeessidremoved+0xb0>
mov    -0x18(%rbp),%rax
movslq 0x2e8f(%rip),%rcx
cmpl   $0x61,(%rax,%rcx,4)
jl     1205 <writeessidremoved+0xe5>
mov    -0x18(%rbp),%rax
movslq 0x2e7a(%rip),%rcx
cmpl   $0x7a,(%rax,%rcx,4)
jg     1205 <writeessidremoved+0xe5>
mov    -0x18(%rbp),%rax
movslq 0x2e65(%rip),%rcx
mov    (%rax,%rcx,4),%eax
mov    %al,%dl
movslq 0x2e5d(%rip),%rcx
lea    0x2e62(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    0x2e4d(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e44(%rip)
jmp    121e <writeessidremoved+0xfe>
mov    0x2e3d(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2e34(%rip)
movl   $0x1,0x2e2e(%rip)
jmp    1223 <writeessidremoved+0x103>
mov    0x2e17(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e0e(%rip)
jmp    116d <writeessidremoved+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <writeessidadd@plt>
cmpl   $0x1,0x2e01(%rip)
jne    1261 <writeessidremoved+0x141>
mov    -0x8(%rbp),%rdi
lea    0x2df4(%rip),%rsi
call   1040 <writeessidadd@plt>
mov    0x2de5(%rip),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeessidremoved>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
movl   $0x0,0x2f06(%rip)
movb   $0x0,0x2f07(%rip)
mov    %esi,0x2efd(%rip)
lea    0x2f02(%rip),%r12
xor    %r15d,%r15d
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
test   %ebp,%ebp
jle    11ba <writeessidremoved+0x9a>
mov    0x2ed6(%rip),%eax
mov    0x2ed4(%rip),%ecx
mov    %ebp,%edx
xor    %esi,%esi
jmp    1199 <writeessidremoved+0x79>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%ecx
mov    %ecx,0x2ebb(%rip)
movb   $0x1,0x2eb8(%rip)
add    $0x1,%rsi
cmp    %rsi,%rdx
je     11ba <writeessidremoved+0x9a>
mov    (%rbx,%rsi,4),%ebp
mov    %ebp,%edi
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
cmp    $0x19,%edi
ja     1180 <writeessidremoved+0x60>
cltq
mov    %bpl,(%rax,%r12,1)
add    $0x1,%eax
mov    %eax,0x2e88(%rip)
jmp    1190 <writeessidremoved+0x70>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <writeessidadd@plt>
cmpb   $0x1,0x2e7c(%rip)
jne    11e5 <writeessidremoved+0xc5>
lea    0x2e7b(%rip),%rsi
mov    %r14,%rdi
call   1040 <writeessidadd@plt>
movzbl 0x2e63(%rip),%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@writeessidremoved.pi = internal global i32 0
@writeessidremoved.po = internal global i32 0
@writeessidremoved.essidlentmp = internal global i32 0
@writeessidremoved.removeflag = internal global i32 0
@writeessidremoved.essidtmp = internal global [64 x i8] zeroinitializer
define i32 @writeessidremoved(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
store i32 0, i32* @writeessidremoved.po
store i32 0, i32* @writeessidremoved.removeflag
%7 = load i32, i32* %5
store i32 %7, i32* @writeessidremoved.essidlentmp
%8 = call i32 @memset(i8** bitcast ([64 x i8]* @writeessidremoved.essidtmp to i8**), i32 0, i32 64)
store i32 0, i32* @writeessidremoved.pi
br label %9
9: ; preds = %57, %3
%10 = load i32, i32* @writeessidremoved.pi
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %60
13: ; preds = %9
%14 = load i32*, i32** %6
%15 = load i32, i32* @writeessidremoved.pi
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = icmp sge i32 %18, 65
br i1 %19, label %20, label %27
20: ; preds = %13
%21 = load i32*, i32** %6
%22 = load i32, i32* @writeessidremoved.pi
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = icmp sle i32 %25, 90
br i1 %26, label %41, label %27
27: ; preds = %20, %13
%28 = load i32*, i32** %6
%29 = load i32, i32* @writeessidremoved.pi
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = icmp sge i32 %32, 97
br i1 %33, label %34, label %53
34: ; preds = %27
%35 = load i32*, i32** %6
%36 = load i32, i32* @writeessidremoved.pi
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
%39 = load i32, i32* %38
%40 = icmp sle i32 %39, 122
br i1 %40, label %41, label %53
41: ; preds = %34, %20
%42 = load i32*, i32** %6
%43 = load i32, i32* @writeessidremoved.pi
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
%46 = load i32, i32* %45
%47 = trunc i32 %46 to i8
%48 = load i32, i32* @writeessidremoved.po
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [64 x i8], [64 x i8]* @writeessidremoved.essidtmp, i64 0, i64 %49
store i8 %47, i8* %50
%51 = load i32, i32* @writeessidremoved.po
%52 = add nsw i32 %51, 1
store i32 %52, i32* @writeessidremoved.po
br label %56
53: ; preds = %34, %27
%54 = load i32, i32* @writeessidremoved.essidlentmp
%55 = add nsw i32 %54, -1
store i32 %55, i32* @writeessidremoved.essidlentmp
store i32 1, i32* @writeessidremoved.removeflag
br label %56
56: ; preds = %53, %41
br label %57
57: ; preds = %56
%58 = load i32, i32* @writeessidremoved.pi
%59 = add nsw i32 %58, 1
store i32 %59, i32* @writeessidremoved.pi
br label %9
60: ; preds = %9
%61 = load i32*, i32** %4
%62 = load i32*, i32** %6
%63 = bitcast i32* %62 to i8*
%64 = call i32 @writeessidadd(i32* %61, i8* %63)
%65 = load i32, i32* @writeessidremoved.removeflag
%66 = icmp eq i32 %65, 1
br i1 %66, label %67, label %70
67: ; preds = %60
%68 = load i32*, i32** %4
%69 = call i32 @writeessidadd(i32* %68, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @writeessidremoved.essidtmp, i64 0, i64 0))
br label %70
70: ; preds = %67, %60
%71 = load i32, i32* @writeessidremoved.removeflag
ret i32 %71
}

LLVM IR (-O2):
@writeessidremoved.po = internal unnamed_addr global i32 0
@writeessidremoved.essidlentmp = internal unnamed_addr global i32 0
@writeessidremoved.removeflag = internal unnamed_addr global i1 false
@writeessidremoved.essidtmp = internal global [64 x i8] zeroinitializer
define i32 @writeessidremoved(i32* %0, i32 %1, i32* %2) {
store i32 0, i32* @writeessidremoved.po
store i1 false, i1* @writeessidremoved.removeflag
store i32 %1, i32* @writeessidremoved.essidlentmp
%4 = tail call i32 @memset(i8** bitcast ([64 x i8]* @writeessidremoved.essidtmp to i8**), i32 0, i32 64)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %31
6: ; preds = %3
%7 = load i32, i32* @writeessidremoved.po
%8 = load i32, i32* @writeessidremoved.essidlentmp
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %6, %26
%11 = phi i64 [ 0, %6 ], [ %29, %26 ]
%12 = phi i32 [ %8, %6 ], [ %28, %26 ]
%13 = phi i32 [ %7, %6 ], [ %27, %26 ]
%14 = getelementptr inbounds i32, i32* %2, i64 %11
%15 = load i32, i32* %14
%16 = and i32 %15, -33
%17 = add i32 %16, -65
%18 = icmp ult i32 %17, 26
br i1 %18, label %19, label %24
19: ; preds = %10
%20 = trunc i32 %15 to i8
%21 = sext i32 %13 to i64
%22 = getelementptr inbounds [64 x i8], [64 x i8]* @writeessidremoved.essidtmp, i64 0, i64 %21
store i8 %20, i8* %22
%23 = add nsw i32 %13, 1
store i32 %23, i32* @writeessidremoved.po
br label %26
24: ; preds = %10
%25 = add nsw i32 %12, -1
store i32 %25, i32* @writeessidremoved.essidlentmp
store i1 true, i1* @writeessidremoved.removeflag
br label %26
26: ; preds = %19, %24
%27 = phi i32 [ %23, %19 ], [ %13, %24 ]
%28 = phi i32 [ %12, %19 ], [ %25, %24 ]
%29 = add nuw nsw i64 %11, 1
%30 = icmp eq i64 %29, %9
br i1 %30, label %31, label %10
31: ; preds = %26, %3
%32 = bitcast i32* %2 to i8*
%33 = tail call i32 @writeessidadd(i32* %0, i8* %32)
%34 = load i1, i1* @writeessidremoved.removeflag
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = tail call i32 @writeessidadd(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @writeessidremoved.essidtmp, i64 0, i64 0))
%37 = load i1, i1* @writeessidremoved.removeflag
%38 = zext i1 %37 to i32
br label %39
39: ; preds = %35, %31
%40 = phi i32 [ %38, %35 ], [ 0, %31 ]
ret i32 %40
}