#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*/ p_uchar(int **, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("print string one byte by one byte in host environment\n");
  printf("use 2 hexadecimal numbers\n");
  int a[3];
  int num = 3;
  a[0] = 0x12345678;
  a[1] = 0x90abcdef;
  printf("&a[0] = %p\n", &a[0]);
  printf("&a[1] = %p\n", &a[1]);
  p_uchar(&a, num * sizeof(int), 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x20(%rbp)
movl   $0x12345678,-0x1c(%rbp)
movl   $0x90abcdef,-0x18(%rbp)
lea    -0x1c(%rbp),%rsi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1c(%rbp),%rsi
add    $0x4,%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1c(%rbp),%rdi
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <p_uchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
movabs $0x90abcdef12345678,%rax
cd ab 90
mov    %rax,0xc(%rsp)
lea    0x10(%rsp),%r14
lea    0xe96(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x1,%edx
call   1050 <p_uchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [55 x i8] c"print string one byte by one byte in host environment\0A\00"
@.str.1 = [27 x i8] c"use 2 hexadecimal numbers\0A\00"
@.str.2 = [12 x i8] c"&a[0] = %p\0A\00"
@.str.3 = [12 x i8] c"&a[1] = %p\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
store i32 3, i32* %7
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
store i32 305419896, i32* %10
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 1
store i32 -1867788817, i32* %11
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32* %14)
%16 = bitcast [3 x i32]* %6 to i32**
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = mul i64 %18, 4
%20 = trunc i64 %19 to i32
%21 = call i32 @p_uchar(i32** %16, i32 %20, i32 1)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [12 x i8] c"&a[0] = %p\0A\00"
@.str.3 = [12 x i8] c"&a[1] = %p\0A\00"
@str = [54 x i8] c"print string one byte by one byte in host environment\00"
@str.4 = [26 x i8] c"use 2 hexadecimal numbers\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i32]
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.4, i64 0, i64 0))
%6 = bitcast [3 x i32]* %3 to i8*
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
store i32 305419896, i32* %7
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
store i32 -1867788817, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32* %8)
%11 = bitcast [3 x i32]* %3 to i32**
%12 = call i32 @p_uchar(i32** %11, i32 12, i32 1)
ret i32 0
}