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

/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, int *);
void stringToBlock(char *str, unsigned char block[16]) {
  int i;
  for (i = 0; i < 16; i++) {
    int temp;
    sscanf(&str[2 * i], "%02X", &temp);
    block[i] = (unsigned char)temp;
  }
}


x86 assembly (clang, -O0):
<stringToBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    116e <stringToBlock+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rdi
lea    0xeb9(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <stringToBlock+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringToBlock>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedb(%rip),%r15
lea    0x4(%rsp),%r12
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,(%r14)
lea    0x2(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x1(%r14)
lea    0x4(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x2(%r14)
lea    0x6(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x3(%r14)
lea    0x8(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x4(%r14)
lea    0xa(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x5(%r14)
lea    0xc(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x6(%r14)
lea    0xe(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x7(%r14)
lea    0x10(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x8(%r14)
lea    0x12(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0x9(%r14)
lea    0x14(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0xa(%r14)
lea    0x16(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0xb(%r14)
lea    0x18(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0xc(%r14)
lea    0x1a(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0xd(%r14)
lea    0x1c(%rbx),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0xe(%r14)
add    $0x1e,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%al
mov    %al,0xf(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%02X\00"
define void @stringToBlock(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %23, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 16
br i1 %9, label %10, label %26
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = mul nsw i32 2, %12
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %6)
%17 = load i32, i32* %6
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 %18, i8* %22
br label %23
23: ; preds = %10
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %7
26: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02X\00"
define void @stringToBlock(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = trunc i32 %6 to i8
store i8 %7, i8* %1
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %11, i8* %12
%13 = getelementptr inbounds i8, i8* %0, i64 4
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %16, i8* %17
%18 = getelementptr inbounds i8, i8* %0, i64 6
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%20 = load i32, i32* %3
%21 = trunc i32 %20 to i8
%22 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %21, i8* %22
%23 = getelementptr inbounds i8, i8* %0, i64 8
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%25 = load i32, i32* %3
%26 = trunc i32 %25 to i8
%27 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %26, i8* %27
%28 = getelementptr inbounds i8, i8* %0, i64 10
%29 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%30 = load i32, i32* %3
%31 = trunc i32 %30 to i8
%32 = getelementptr inbounds i8, i8* %1, i64 5
store i8 %31, i8* %32
%33 = getelementptr inbounds i8, i8* %0, i64 12
%34 = call i32 @sscanf(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%35 = load i32, i32* %3
%36 = trunc i32 %35 to i8
%37 = getelementptr inbounds i8, i8* %1, i64 6
store i8 %36, i8* %37
%38 = getelementptr inbounds i8, i8* %0, i64 14
%39 = call i32 @sscanf(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%40 = load i32, i32* %3
%41 = trunc i32 %40 to i8
%42 = getelementptr inbounds i8, i8* %1, i64 7
store i8 %41, i8* %42
%43 = getelementptr inbounds i8, i8* %0, i64 16
%44 = call i32 @sscanf(i8* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%45 = load i32, i32* %3
%46 = trunc i32 %45 to i8
%47 = getelementptr inbounds i8, i8* %1, i64 8
store i8 %46, i8* %47
%48 = getelementptr inbounds i8, i8* %0, i64 18
%49 = call i32 @sscanf(i8* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%50 = load i32, i32* %3
%51 = trunc i32 %50 to i8
%52 = getelementptr inbounds i8, i8* %1, i64 9
store i8 %51, i8* %52
%53 = getelementptr inbounds i8, i8* %0, i64 20
%54 = call i32 @sscanf(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%55 = load i32, i32* %3
%56 = trunc i32 %55 to i8
%57 = getelementptr inbounds i8, i8* %1, i64 10
store i8 %56, i8* %57
%58 = getelementptr inbounds i8, i8* %0, i64 22
%59 = call i32 @sscanf(i8* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%60 = load i32, i32* %3
%61 = trunc i32 %60 to i8
%62 = getelementptr inbounds i8, i8* %1, i64 11
store i8 %61, i8* %62
%63 = getelementptr inbounds i8, i8* %0, i64 24
%64 = call i32 @sscanf(i8* %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%65 = load i32, i32* %3
%66 = trunc i32 %65 to i8
%67 = getelementptr inbounds i8, i8* %1, i64 12
store i8 %66, i8* %67
%68 = getelementptr inbounds i8, i8* %0, i64 26
%69 = call i32 @sscanf(i8* %68, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%70 = load i32, i32* %3
%71 = trunc i32 %70 to i8
%72 = getelementptr inbounds i8, i8* %1, i64 13
store i8 %71, i8* %72
%73 = getelementptr inbounds i8, i8* %0, i64 28
%74 = call i32 @sscanf(i8* %73, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%75 = load i32, i32* %3
%76 = trunc i32 %75 to i8
%77 = getelementptr inbounds i8, i8* %1, i64 14
store i8 %76, i8* %77
%78 = getelementptr inbounds i8, i8* %0, i64 30
%79 = call i32 @sscanf(i8* %78, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%80 = load i32, i32* %3
%81 = trunc i32 %80 to i8
%82 = getelementptr inbounds i8, i8* %1, i64 15
store i8 %81, i8* %82
ret void
}