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

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned long long, int);
int /*<<< orphan*/ writepsk(int /*<<< orphan*/ *, char *);
void test000559(FILE *fhout, unsigned long long int macaddr) {
  static int k1;
  static unsigned long long int oui;
  static char essidtmp[64] = {};
  oui = macaddr & 0xffffff000000L;
  oui = oui >> 24;
  if (oui == 0x000559) {
    for (k1 = 0; k1 < 10000; k1++) {
      snprintf(essidtmp, 64, "%012llX-%04d", macaddr, k1);
      writepsk(fhout, essidtmp);
    }
  }
  return;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0xffffff000000,%rax
and    -0x10(%rbp),%rax
mov    %rax,0x2f03(%rip)
mov    0x2efc(%rip),%rax
shr    $0x18,%rax
mov    %rax,0x2ef1(%rip)
cmpq   $0x559,0x2ee6(%rip)
jne    11ce <test000559+0xae>
movl   $0x0,0x2ece(%rip)
cmpl   $0x2710,0x2ec4(%rip)
jge    11c9 <test000559+0xa9>
mov    -0x10(%rbp),%rcx
mov    0x2eb3(%rip),%r8d
lea    0x2ebc(%rip),%rdi
mov    $0x40,%esi
lea    0xe60(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x2ea0(%rip),%rsi
call   1040 <writepsk@plt>
mov    0x2e85(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e7c(%rip)
jmp    1172 <test000559+0x52>
jmp    11ce <test000559+0xae>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movabs $0xffffff000000,%rax
and    %rsi,%rax
movabs $0x559000000,%rcx
cmp    %rcx,%rax
jne    11a6 <test000559+0x86>
mov    %rsi,%r15
mov    %rdi,%r14
movl   $0x0,0x2eec(%rip)
xor    %r8d,%r8d
lea    0x2ef2(%rip),%rbx
lea    0xe9b(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <snprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <writepsk@plt>
mov    0x2eac(%rip),%eax
lea    0x1(%rax),%r8d
mov    %r8d,0x2ea1(%rip)
cmp    $0x270f,%eax
jl     1170 <test000559+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@test000559.k1 = internal global i32 0
@test000559.oui = internal global i64 0
@test000559.essidtmp = internal global [64 x i8] zeroinitializer
@.str = [13 x i8] c"%012llX-%04d\00"
define void @test000559(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = and i64 %5, 281474959933440
store i64 %6, i64* @test000559.oui
%7 = load i64, i64* @test000559.oui
%8 = lshr i64 %7, 24
store i64 %8, i64* @test000559.oui
%9 = load i64, i64* @test000559.oui
%10 = icmp eq i64 %9, 1369
br i1 %10, label %11, label %25
11: ; preds = %2
store i32 0, i32* @test000559.k1
br label %12
12: ; preds = %21, %11
%13 = load i32, i32* @test000559.k1
%14 = icmp slt i32 %13, 10000
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = load i64, i64* %4
%17 = load i32, i32* @test000559.k1
%18 = call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @test000559.essidtmp, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %16, i32 %17)
%19 = load i32*, i32** %3
%20 = call i32 @writepsk(i32* %19, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @test000559.essidtmp, i64 0, i64 0))
br label %21
21: ; preds = %15
%22 = load i32, i32* @test000559.k1
%23 = add nsw i32 %22, 1
store i32 %23, i32* @test000559.k1
br label %12
24: ; preds = %12
br label %25
25: ; preds = %24, %2
ret void
}

LLVM IR (-O2):
@test000559.k1 = internal unnamed_addr global i32 0
@test000559.essidtmp = internal global [64 x i8] zeroinitializer
@.str = [13 x i8] c"%012llX-%04d\00"
define void @test000559(i32* %0, i64 %1) {
%3 = and i64 %1, 281474959933440
%4 = icmp eq i64 %3, 22968008704
br i1 %4, label %5, label %13
5: ; preds = %2
store i32 0, i32* @test000559.k1
br label %6
6: ; preds = %5, %6
%7 = phi i32 [ 0, %5 ], [ %11, %6 ]
%8 = tail call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @test000559.essidtmp, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %1, i32 %7)
%9 = tail call i32 @writepsk(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @test000559.essidtmp, i64 0, i64 0))
%10 = load i32, i32* @test000559.k1
%11 = add nsw i32 %10, 1
store i32 %11, i32* @test000559.k1
%12 = icmp slt i32 %10, 9999
br i1 %12, label %6, label %13
13: ; preds = %6, %2
ret void
}