#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*/ kill_time(int);
int /*<<< orphan*/ printf(char *, int, unsigned char, unsigned char);
void write_frame_basic(unsigned char write_field[]) {
  int i = 0;
  for (i = 0; i < 10; i++) {
    *((unsigned char *)(0xfffc0000 + 0x000A + i)) = write_field[i];
    kill_time(10);
    printf("write data: %i , 0x%X , 0x%X \n", i, write_field[i],
           *((unsigned char *)(0xfffc0000 + 0x000A + i)));
  }
}


x86 assembly (clang, -O0):
<write_frame_basic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    119d <write_frame_basic+0x7d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0xc(%rbp),%eax
add    $0xfffc000a,%eax
mov    %eax,%eax
mov    %cl,(%rax)
mov    $0xa,%edi
call   1030 <kill_time@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0xc(%rbp),%eax
add    $0xfffc000a,%eax
mov    %eax,%eax
lea    0xe7c(%rip),%rdi
movzbl %cl,%edx
movzbl (%rax),%ecx
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <write_frame_basic+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_frame_basic>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
mov    $0xfffc000a,%r15d
mov    %al,(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl (%rbx),%edx
movzbl (%r15),%ecx
lea    0xeb5(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    0x1(%rbx),%al
mov    %al,0x1(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x1(%rbx),%edx
movzbl 0x1(%r15),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    0x2(%rbx),%al
mov    %al,0x2(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x2(%rbx),%edx
movzbl 0x2(%r15),%ecx
mov    %r14,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    0x3(%rbx),%al
mov    %al,0x3(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x3(%rbx),%edx
movzbl 0x3(%r15),%ecx
mov    %r14,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
mov    0x4(%rbx),%al
mov    %al,0x4(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x4(%rbx),%edx
movzbl 0x4(%r15),%ecx
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    0x5(%rbx),%al
mov    %al,0x5(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x5(%rbx),%edx
movzbl 0x5(%r15),%ecx
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
mov    0x6(%rbx),%al
mov    %al,0x6(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x6(%rbx),%edx
movzbl 0x6(%r15),%ecx
mov    %r14,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
mov    0x7(%rbx),%al
mov    %al,0x7(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x7(%rbx),%edx
movzbl 0x7(%r15),%ecx
mov    %r14,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
mov    0x8(%rbx),%al
mov    %al,0x8(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x8(%rbx),%edx
movzbl 0x8(%r15),%ecx
mov    %r14,%rdi
mov    $0x8,%esi
call   1040 <printf@plt>
mov    0x9(%rbx),%al
mov    %al,0x9(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0x9(%rbx),%edx
movzbl 0x9(%r15),%ecx
mov    %r14,%rdi
mov    $0x9,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"write data: %i , 0x%X , 0x%X \0A\00"
define void @write_frame_basic(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %30, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %33
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = load i32, i32* %3
%14 = add i32 -262134, %13
%15 = zext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
store i8 %12, i8* %16
%17 = call i32 @kill_time(i32 10)
%18 = load i32, i32* %3
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = load i32, i32* %3
%25 = add i32 -262134, %24
%26 = zext i32 %25 to i64
%27 = inttoptr i64 %26 to i8*
%28 = load i8, i8* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %18, i8 zeroext %23, i8 zeroext %28)
br label %30
30: ; preds = %7
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %4
33: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"write data: %i , 0x%X , 0x%X \0A\00"
define void @write_frame_basic(i8* nocapture %0) {
%2 = load i8, i8* %0
store i8 %2, i8* inttoptr (i64 4294705162 to i8*)
%3 = tail call i32 @kill_time(i32 10)
%4 = load i8, i8* %0
%5 = load i8, i8* inttoptr (i64 4294705162 to i8*)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 0, i8 zeroext %4, i8 zeroext %5)
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
store i8 %8, i8* inttoptr (i64 4294705163 to i8*)
%9 = tail call i32 @kill_time(i32 10)
%10 = load i8, i8* %7
%11 = load i8, i8* inttoptr (i64 4294705163 to i8*)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 1, i8 zeroext %10, i8 zeroext %11)
%13 = getelementptr inbounds i8, i8* %0, i64 2
%14 = load i8, i8* %13
store i8 %14, i8* inttoptr (i64 4294705164 to i8*)
%15 = tail call i32 @kill_time(i32 10)
%16 = load i8, i8* %13
%17 = load i8, i8* inttoptr (i64 4294705164 to i8*)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 2, i8 zeroext %16, i8 zeroext %17)
%19 = getelementptr inbounds i8, i8* %0, i64 3
%20 = load i8, i8* %19
store i8 %20, i8* inttoptr (i64 4294705165 to i8*)
%21 = tail call i32 @kill_time(i32 10)
%22 = load i8, i8* %19
%23 = load i8, i8* inttoptr (i64 4294705165 to i8*)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 3, i8 zeroext %22, i8 zeroext %23)
%25 = getelementptr inbounds i8, i8* %0, i64 4
%26 = load i8, i8* %25
store i8 %26, i8* inttoptr (i64 4294705166 to i8*)
%27 = tail call i32 @kill_time(i32 10)
%28 = load i8, i8* %25
%29 = load i8, i8* inttoptr (i64 4294705166 to i8*)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 4, i8 zeroext %28, i8 zeroext %29)
%31 = getelementptr inbounds i8, i8* %0, i64 5
%32 = load i8, i8* %31
store i8 %32, i8* inttoptr (i64 4294705167 to i8*)
%33 = tail call i32 @kill_time(i32 10)
%34 = load i8, i8* %31
%35 = load i8, i8* inttoptr (i64 4294705167 to i8*)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 5, i8 zeroext %34, i8 zeroext %35)
%37 = getelementptr inbounds i8, i8* %0, i64 6
%38 = load i8, i8* %37
store i8 %38, i8* inttoptr (i64 4294705168 to i8*)
%39 = tail call i32 @kill_time(i32 10)
%40 = load i8, i8* %37
%41 = load i8, i8* inttoptr (i64 4294705168 to i8*)
%42 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 6, i8 zeroext %40, i8 zeroext %41)
%43 = getelementptr inbounds i8, i8* %0, i64 7
%44 = load i8, i8* %43
store i8 %44, i8* inttoptr (i64 4294705169 to i8*)
%45 = tail call i32 @kill_time(i32 10)
%46 = load i8, i8* %43
%47 = load i8, i8* inttoptr (i64 4294705169 to i8*)
%48 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 7, i8 zeroext %46, i8 zeroext %47)
%49 = getelementptr inbounds i8, i8* %0, i64 8
%50 = load i8, i8* %49
store i8 %50, i8* inttoptr (i64 4294705170 to i8*)
%51 = tail call i32 @kill_time(i32 10)
%52 = load i8, i8* %49
%53 = load i8, i8* inttoptr (i64 4294705170 to i8*)
%54 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 8, i8 zeroext %52, i8 zeroext %53)
%55 = getelementptr inbounds i8, i8* %0, i64 9
%56 = load i8, i8* %55
store i8 %56, i8* inttoptr (i64 4294705171 to i8*)
%57 = tail call i32 @kill_time(i32 10)
%58 = load i8, i8* %55
%59 = load i8, i8* inttoptr (i64 4294705171 to i8*)
%60 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 9, i8 zeroext %58, i8 zeroext %59)
ret void
}