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

/* Variables and functions */
int /*<<< orphan*/ MD5_Final(int *, int /*<<< orphan*/ *);
int /*<<< orphan*/ MD5_Init(int /*<<< orphan*/ *);
int /*<<< orphan*/ MD5_Update(int /*<<< orphan*/ *, void *, size_t);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(int);
void gen_ssid(void *in, size_t len) {
  int i;
  MD5_CTX ctx;
  uint8_t dgst[16];
  MD5_Init(&ctx);
  MD5_Update(&ctx, in, len);
  MD5_Final(dgst, &ctx);
  printf("\n  SSID     : %s", "eircom");
  for (i = 0; i < 8; i++) {
    putchar((dgst[i] % 10) + '0');
  }
}


x86 assembly (clang, -O0):
<gen_ssid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1060 <MD5_Init@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
call   1070 <MD5_Update@plt>
lea    -0x60(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <MD5_Final@plt>
lea    0xe72(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11d3 <gen_ssid+0x83>
movslq -0x14(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a1 <gen_ssid+0x51>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_ssid>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xc(%rsp),%r15
mov    %r15,%rdi
call   1060 <MD5_Init@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <MD5_Update@plt>
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1040 <MD5_Final@plt>
lea    0xe72(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1050 <printf@plt>
movslq 0x10(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
movslq 0x14(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
movslq 0x18(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
movslq 0x1c(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
movslq 0x20(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
movslq 0x24(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
movslq 0x28(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
movslq 0x2c(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0A SSID : %s\00"
@.str.1 = [7 x i8] c"eircom\00"
define void @gen_ssid(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca [16 x i32]
store i8* %0, i8** %3
store i64 %1, i64* %4
%8 = call i32 @MD5_Init(i32* %6)
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i32 @MD5_Update(i32* %6, i8* %9, i64 %10)
%12 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 0
%13 = call i32 @MD5_Final(i32* %12, i32* %6)
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %15
15: ; preds = %26, %2
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 8
br i1 %17, label %18, label %29
18: ; preds = %15
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = srem i32 %22, 10
%24 = add nsw i32 %23, 48
%25 = call i32 @putchar(i32 %24)
br label %26
26: ; preds = %18
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %15
29: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0A SSID : %s\00"
@.str.1 = [7 x i8] c"eircom\00"
define void @gen_ssid(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca [16 x i32]
%5 = bitcast i32* %3 to i8*
%6 = bitcast [16 x i32]* %4 to i8*
%7 = call i32 @MD5_Init(i32* %3)
%8 = call i32 @MD5_Update(i32* %3, i8* %0, i64 %1)
%9 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%10 = call i32 @MD5_Final(i32* %9, i32* %3)
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %9
%13 = srem i32 %12, 10
%14 = add nsw i32 %13, 48
%15 = call i32 @putchar(i32 %14)
%16 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 1
%17 = load i32, i32* %16
%18 = srem i32 %17, 10
%19 = add nsw i32 %18, 48
%20 = call i32 @putchar(i32 %19)
%21 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 2
%22 = load i32, i32* %21
%23 = srem i32 %22, 10
%24 = add nsw i32 %23, 48
%25 = call i32 @putchar(i32 %24)
%26 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 3
%27 = load i32, i32* %26
%28 = srem i32 %27, 10
%29 = add nsw i32 %28, 48
%30 = call i32 @putchar(i32 %29)
%31 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 4
%32 = load i32, i32* %31
%33 = srem i32 %32, 10
%34 = add nsw i32 %33, 48
%35 = call i32 @putchar(i32 %34)
%36 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 5
%37 = load i32, i32* %36
%38 = srem i32 %37, 10
%39 = add nsw i32 %38, 48
%40 = call i32 @putchar(i32 %39)
%41 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 6
%42 = load i32, i32* %41
%43 = srem i32 %42, 10
%44 = add nsw i32 %43, 48
%45 = call i32 @putchar(i32 %44)
%46 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 7
%47 = load i32, i32* %46
%48 = srem i32 %47, 10
%49 = add nsw i32 %48, 48
%50 = call i32 @putchar(i32 %49)
ret void
}