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


x86 assembly (clang, -O0):
<write_frame_extended>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xd,-0xc(%rbp)
jge    11ab <write_frame_extended+0x8b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0xc(%rbp),%eax
add    $0xfffc0010,%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
movzbl (%rax,%rcx,1),%edx
mov    -0xc(%rbp),%eax
add    $0xfffc0010,%eax
mov    %eax,%eax
movzbl (%rax),%ecx
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <write_frame_extended+0x28>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_frame_extended>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%al
mov    $0xfffc0010,%r15d
mov    %al,(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl (%rbx),%edx
movzbl (%r15),%ecx
lea    0xe99(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <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
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xa(%rbx),%al
mov    %al,0xa(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0xa(%rbx),%edx
movzbl 0xa(%r15),%ecx
mov    %r14,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xb(%rbx),%al
mov    %al,0xb(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0xb(%rbx),%edx
movzbl 0xb(%r15),%ecx
mov    %r14,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rbx),%al
mov    %al,0xc(%r15)
mov    $0xa,%edi
call   1030 <kill_time@plt>
movzbl 0xc(%rbx),%edx
movzbl 0xc(%r15),%ecx
mov    %r14,%rdi
mov    $0xc,%esi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <printf@plt>

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

LLVM IR (-O2):
@.str.1 = [30 x i8] c"write data %i: 0x%X , 0x%X \0A\00"
@str = [37 x i8] c"******* write frame extended *******\00"
define void @write_frame_extended(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%3 = load i8, i8* %0
store i8 %3, i8* inttoptr (i64 4294705168 to i8*)
%4 = tail call i32 @kill_time(i32 10)
%5 = load i8, i8* %0
%6 = zext i8 %5 to i32
%7 = load i8, i8* inttoptr (i64 4294705168 to i8*)
%8 = zext i8 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %6, i32 %8)
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
store i8 %11, i8* inttoptr (i64 4294705169 to i8*)
%12 = tail call i32 @kill_time(i32 10)
%13 = load i8, i8* %10
%14 = zext i8 %13 to i32
%15 = load i8, i8* inttoptr (i64 4294705169 to i8*)
%16 = zext i8 %15 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %14, i32 %16)
%18 = getelementptr inbounds i8, i8* %0, i64 2
%19 = load i8, i8* %18
store i8 %19, i8* inttoptr (i64 4294705170 to i8*)
%20 = tail call i32 @kill_time(i32 10)
%21 = load i8, i8* %18
%22 = zext i8 %21 to i32
%23 = load i8, i8* inttoptr (i64 4294705170 to i8*)
%24 = zext i8 %23 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %22, i32 %24)
%26 = getelementptr inbounds i8, i8* %0, i64 3
%27 = load i8, i8* %26
store i8 %27, i8* inttoptr (i64 4294705171 to i8*)
%28 = tail call i32 @kill_time(i32 10)
%29 = load i8, i8* %26
%30 = zext i8 %29 to i32
%31 = load i8, i8* inttoptr (i64 4294705171 to i8*)
%32 = zext i8 %31 to i32
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %30, i32 %32)
%34 = getelementptr inbounds i8, i8* %0, i64 4
%35 = load i8, i8* %34
store i8 %35, i8* inttoptr (i64 4294705172 to i8*)
%36 = tail call i32 @kill_time(i32 10)
%37 = load i8, i8* %34
%38 = zext i8 %37 to i32
%39 = load i8, i8* inttoptr (i64 4294705172 to i8*)
%40 = zext i8 %39 to i32
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %38, i32 %40)
%42 = getelementptr inbounds i8, i8* %0, i64 5
%43 = load i8, i8* %42
store i8 %43, i8* inttoptr (i64 4294705173 to i8*)
%44 = tail call i32 @kill_time(i32 10)
%45 = load i8, i8* %42
%46 = zext i8 %45 to i32
%47 = load i8, i8* inttoptr (i64 4294705173 to i8*)
%48 = zext i8 %47 to i32
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %46, i32 %48)
%50 = getelementptr inbounds i8, i8* %0, i64 6
%51 = load i8, i8* %50
store i8 %51, i8* inttoptr (i64 4294705174 to i8*)
%52 = tail call i32 @kill_time(i32 10)
%53 = load i8, i8* %50
%54 = zext i8 %53 to i32
%55 = load i8, i8* inttoptr (i64 4294705174 to i8*)
%56 = zext i8 %55 to i32
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %54, i32 %56)
%58 = getelementptr inbounds i8, i8* %0, i64 7
%59 = load i8, i8* %58
store i8 %59, i8* inttoptr (i64 4294705175 to i8*)
%60 = tail call i32 @kill_time(i32 10)
%61 = load i8, i8* %58
%62 = zext i8 %61 to i32
%63 = load i8, i8* inttoptr (i64 4294705175 to i8*)
%64 = zext i8 %63 to i32
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %62, i32 %64)
%66 = getelementptr inbounds i8, i8* %0, i64 8
%67 = load i8, i8* %66
store i8 %67, i8* inttoptr (i64 4294705176 to i8*)
%68 = tail call i32 @kill_time(i32 10)
%69 = load i8, i8* %66
%70 = zext i8 %69 to i32
%71 = load i8, i8* inttoptr (i64 4294705176 to i8*)
%72 = zext i8 %71 to i32
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %70, i32 %72)
%74 = getelementptr inbounds i8, i8* %0, i64 9
%75 = load i8, i8* %74
store i8 %75, i8* inttoptr (i64 4294705177 to i8*)
%76 = tail call i32 @kill_time(i32 10)
%77 = load i8, i8* %74
%78 = zext i8 %77 to i32
%79 = load i8, i8* inttoptr (i64 4294705177 to i8*)
%80 = zext i8 %79 to i32
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %78, i32 %80)
%82 = getelementptr inbounds i8, i8* %0, i64 10
%83 = load i8, i8* %82
store i8 %83, i8* inttoptr (i64 4294705178 to i8*)
%84 = tail call i32 @kill_time(i32 10)
%85 = load i8, i8* %82
%86 = zext i8 %85 to i32
%87 = load i8, i8* inttoptr (i64 4294705178 to i8*)
%88 = zext i8 %87 to i32
%89 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 %86, i32 %88)
%90 = getelementptr inbounds i8, i8* %0, i64 11
%91 = load i8, i8* %90
store i8 %91, i8* inttoptr (i64 4294705179 to i8*)
%92 = tail call i32 @kill_time(i32 10)
%93 = load i8, i8* %90
%94 = zext i8 %93 to i32
%95 = load i8, i8* inttoptr (i64 4294705179 to i8*)
%96 = zext i8 %95 to i32
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 11, i32 %94, i32 %96)
%98 = getelementptr inbounds i8, i8* %0, i64 12
%99 = load i8, i8* %98
store i8 %99, i8* inttoptr (i64 4294705180 to i8*)
%100 = tail call i32 @kill_time(i32 10)
%101 = load i8, i8* %98
%102 = zext i8 %101 to i32
%103 = load i8, i8* inttoptr (i64 4294705180 to i8*)
%104 = zext i8 %103 to i32
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 12, i32 %102, i32 %104)
ret void
}