#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*/ emit(char *);
int /*<<< orphan*/ perform_cached_rebase();
int /*<<< orphan*/ ret_timing(int);
void i_rtd(void) {
  emit("mov edx,[__a7]\n");
  emit("call readmemorydword\n");
  emit("movsx ebx,word[esi]\n");
  emit("add edx,ebx\n");
  emit("mov esi,ecx\n");
  emit("add edx,byte 4\n");
  emit("xor ebx,ebx\n");
  emit("mov [__a7],edx\n");
  perform_cached_rebase();
  ret_timing(16);
}


x86 assembly (clang, -O0):
<i_rtd>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <emit@plt>
lea    0xec9(%rip),%rdi
call   1040 <emit@plt>
lea    0xed3(%rip),%rdi
call   1040 <emit@plt>
lea    0xedc(%rip),%rdi
call   1040 <emit@plt>
lea    0xedd(%rip),%rdi
call   1040 <emit@plt>
lea    0xede(%rip),%rdi
call   1040 <emit@plt>
lea    0xee2(%rip),%rdi
call   1040 <emit@plt>
lea    0xee3(%rip),%rdi
call   1040 <emit@plt>
mov    $0x0,%al
call   1030 <perform_cached_rebase@plt>
mov    $0x10,%edi
call   1050 <ret_timing@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_rtd>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <emit@plt>
lea    0xecc(%rip),%rdi
call   1040 <emit@plt>
lea    0xed6(%rip),%rdi
call   1040 <emit@plt>
lea    0xedf(%rip),%rdi
call   1040 <emit@plt>
lea    0xee0(%rip),%rdi
call   1040 <emit@plt>
lea    0xee1(%rip),%rdi
call   1040 <emit@plt>
lea    0xee5(%rip),%rdi
call   1040 <emit@plt>
lea    0xee6(%rip),%rdi
call   1040 <emit@plt>
xor    %eax,%eax
call   1030 <perform_cached_rebase@plt>
mov    $0x10,%edi
pop    %rax
jmp    1050 <ret_timing@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"mov edx,[__a7]\0A\00"
@.str.1 = [22 x i8] c"call readmemorydword\0A\00"
@.str.2 = [21 x i8] c"movsx ebx,word[esi]\0A\00"
@.str.3 = [13 x i8] c"add edx,ebx\0A\00"
@.str.4 = [13 x i8] c"mov esi,ecx\0A\00"
@.str.5 = [16 x i8] c"add edx,byte 4\0A\00"
@.str.6 = [13 x i8] c"xor ebx,ebx\0A\00"
@.str.7 = [16 x i8] c"mov [__a7],edx\0A\00"
define void @i_rtd() {
%1 = call i32 @emit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @emit(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @emit(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @emit(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @emit(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%6 = call i32 @emit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%7 = call i32 @emit(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%8 = call i32 @emit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%9 = call i32 (...) @perform_cached_rebase()
%10 = call i32 @ret_timing(i32 16)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"mov edx,[__a7]\0A\00"
@.str.1 = [22 x i8] c"call readmemorydword\0A\00"
@.str.2 = [21 x i8] c"movsx ebx,word[esi]\0A\00"
@.str.3 = [13 x i8] c"add edx,ebx\0A\00"
@.str.4 = [13 x i8] c"mov esi,ecx\0A\00"
@.str.5 = [16 x i8] c"add edx,byte 4\0A\00"
@.str.6 = [13 x i8] c"xor ebx,ebx\0A\00"
@.str.7 = [16 x i8] c"mov [__a7],edx\0A\00"
define void @i_rtd() {
%1 = tail call i32 @emit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @emit(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @emit(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @emit(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @emit(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @emit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 @emit(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 @emit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%9 = tail call i32 (...) @perform_cached_rebase()
%10 = tail call i32 @ret_timing(i32 16)
ret void
}