#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*/ scanf(char *, int *);
void get8(unsigned char *cp) {
  int i, t;
  for (i = 0; i < 8; i++) {
    scanf("%2x", &t);
    *cp++ = t;
  }
}


x86 assembly (clang, -O0):
<get8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1161 <get8+0x51>
lea    0xecc(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <get8+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get8>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xedd(%rip),%r14
lea    0xc(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%al
mov    %al,(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%al
mov    %al,0x1(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%al
mov    %al,0x2(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%al
mov    %al,0x3(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%al
mov    %al,0x4(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%al
mov    %al,0x5(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%al
mov    %al,0x6(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%al
mov    %al,0x7(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%2x\00"
define void @get8(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %5
5: ; preds = %14, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
store i8 %11, i8* %12
br label %14
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%2x\00"
define void @get8(i8* nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %6, i8* %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %10, i8* %7
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %14, i8* %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %18, i8* %15
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%21 = load i32, i32* %2
%22 = trunc i32 %21 to i8
%23 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %22, i8* %19
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%25 = load i32, i32* %2
%26 = trunc i32 %25 to i8
%27 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %26, i8* %23
%28 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%29 = load i32, i32* %2
%30 = trunc i32 %29 to i8
%31 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %30, i8* %27
%32 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%33 = load i32, i32* %2
%34 = trunc i32 %33 to i8
store i8 %34, i8* %31
ret void
}