#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*/ uint8_t;
struct rc4hash {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
int /*<<< orphan*/ rc4hash_unpack(struct rc4hash *, char *);
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/ *, int);
void rc4hash_parse(struct rc4hash *hash, const char *input) {
  uint8_t extract[26];
  char n[3] = {0};
  for (int i = 0; i < 26; i++) {
    memcpy(n, input + i * 2, 2);
    extract[i] = strtol(n, NULL, 16);
  }
  rc4hash_unpack(hash, (char *)extract);
}


x86 assembly (clang, -O0):
<rc4hash_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x83(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
movl   $0x0,-0x88(%rbp)
cmpl   $0x1a,-0x88(%rbp)
jge    11d6 <rc4hash_parse+0x96>
lea    -0x83(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x88(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rsi
mov    $0x2,%edx
call   1050 <memcpy@plt>
lea    -0x83(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,%ecx
movslq -0x88(%rbp),%rax
mov    %ecx,-0x80(%rbp,%rax,4)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1170 <rc4hash_parse+0x30>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1060 <rc4hash_unpack@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc4hash_parse>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
movb   $0x0,0xe(%rsp)
movw   $0x0,0xc(%rsp)
xor    %ebx,%ebx
lea    0xc(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r15,%rbx,1),%rsi
mov    %r12,%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %eax,0x10(%rsp,%rbx,2)
add    $0x2,%rbx
cmp    $0x34,%rbx
jne    1160 <rc4hash_parse+0x30>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1050 <rc4hash_unpack@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.rc4hash = type { i32 }
define void @rc4hash_parse(%struct.rc4hash* %0, i8* %1) {
%3 = alloca %struct.rc4hash*
%4 = alloca i8*
%5 = alloca [26 x i32]
%6 = alloca [3 x i8]
%7 = alloca i32
store %struct.rc4hash* %0, %struct.rc4hash** %3
store i8* %1, i8** %4
%8 = bitcast [3 x i8]* %6 to i8*
store i32 0, i32* %7
br label %9
9: ; preds = %25, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 26
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%14 = load i8*, i8** %4
%15 = load i32, i32* %7
%16 = mul nsw i32 %15, 2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
%19 = call i32 @memcpy(i8* %13, i8* %18, i32 2)
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%21 = call i32 @strtol(i8* %20, i32* null, i32 16)
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [26 x i32], [26 x i32]* %5, i64 0, i64 %23
store i32 %21, i32* %24
br label %25
25: ; preds = %12
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %9
28: ; preds = %9
%29 = load %struct.rc4hash*, %struct.rc4hash** %3
%30 = getelementptr inbounds [26 x i32], [26 x i32]* %5, i64 0, i64 0
%31 = bitcast i32* %30 to i8*
%32 = call i32 @rc4hash_unpack(%struct.rc4hash* %29, i8* %31)
ret void
}

LLVM IR (-O2):
%struct.rc4hash = type { i32 }
define void @rc4hash_parse(%struct.rc4hash* %0, i8* %1) {
%3 = alloca [26 x i32]
%4 = alloca [3 x i8]
%5 = bitcast [26 x i32]* %3 to i8*
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
br label %9
7: ; preds = %9
%8 = call i32 @rc4hash_unpack(%struct.rc4hash* %0, i8* %5)
ret void
9: ; preds = %2, %9
%10 = phi i64 [ 0, %2 ], [ %16, %9 ]
%11 = shl nuw nsw i64 %10, 1
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = call i32 @memcpy(i8* %6, i8* %12, i32 2)
%14 = call i32 @strtol(i8* nocapture %6, i32* null, i32 16)
%15 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 %10
store i32 %14, i32* %15
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, 26
br i1 %17, label %7, label %9
}