#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 */
unsigned char *copyByte(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ dispArray(unsigned char *, int);
int /*<<< orphan*/ printf(char *, unsigned char);
main(void) {
  int i;
  int iVal = 0x12345678;
  char cVal = 0x9a;
  float fVal = 1234.5678;
  short sVal = 0xbcde;
  int iVal1 = 0xf1234567;
  unsigned char message[15];
  unsigned char *src, *dest;
  dest = &message[0];
  src = (char *)&iVal;
  dest = copyByte(src, dest, 4);
  src = (char *)&cVal;
  dest = copyByte(src, dest, 1);
  src = (char *)&fVal;
  dest = copyByte(src, dest, 4);
  src = (char *)&sVal;
  dest = copyByte(src, dest, 2);
  src = (char *)&iVal1;
  dest = copyByte(src, dest, 4);
  for (i = 0; i < 15; i++)
    printf("array = %x\n", message[i]);
  dispArray(message, 15);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x12345678,-0xc(%rbp)
movb   $0x9a,-0xd(%rbp)
movss  0xeae(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movw   $0xbcde,-0x16(%rbp)
movl   $0xf1234567,-0x1c(%rbp)
lea    -0x2b(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   1050 <copyByte@plt>
mov    %rax,-0x40(%rbp)
lea    -0xd(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   1050 <copyByte@plt>
mov    %rax,-0x40(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   1050 <copyByte@plt>
mov    %rax,-0x40(%rbp)
lea    -0x16(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x2,%edx
call   1050 <copyByte@plt>
mov    %rax,-0x40(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   1050 <copyByte@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jge    1236 <main+0x106>
movslq -0x8(%rbp),%rax
lea    0xde6(%rip),%rdi
movzbl -0x2b(%rbp,%rax,1),%esi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1209 <main+0xd9>
lea    -0x2b(%rbp),%rdi
mov    $0xf,%esi
call   1030 <dispArray@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movl   $0x12345678,0x24(%rsp)
12
movb   $0x9a,0xa(%rsp)
movl   $0x449a522b,0x20(%rsp)
44
movw   $0xbcde,0x1a(%rsp)
movl   $0xf1234567,0x1c(%rsp)
f1
lea    0x24(%rsp),%rdi
lea    0xb(%rsp),%r14
mov    %r14,%rsi
mov    $0x4,%edx
call   1050 <copyByte@plt>
lea    0xa(%rsp),%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1050 <copyByte@plt>
lea    0x20(%rsp),%rdi
mov    %rax,%rsi
mov    $0x4,%edx
call   1050 <copyByte@plt>
lea    0x1a(%rsp),%rdi
mov    %rax,%rsi
mov    $0x2,%edx
call   1050 <copyByte@plt>
lea    0x1c(%rsp),%rdi
mov    %rax,%rsi
mov    $0x4,%edx
call   1050 <copyByte@plt>
movzbl 0xb(%rsp),%esi
lea    0xe3a(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xd(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xe(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x10(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x11(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x12(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x13(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x14(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x15(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x16(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x17(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x18(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0x19(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0xf,%esi
call   1030 <dispArray@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"array = %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca float
%6 = alloca i16
%7 = alloca i32
%8 = alloca [15 x i8]
%9 = alloca i8*
%10 = alloca i8*
store i32 0, i32* %1
store i32 305419896, i32* %3
store i8 -102, i8* %4
store float 0x40934A4560000000, float* %5
store i16 -17186, i16* %6
store i32 -249346713, i32* %7
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %8, i64 0, i64 0
store i8* %11, i8** %10
%12 = bitcast i32* %3 to i8*
store i8* %12, i8** %9
%13 = load i8*, i8** %9
%14 = load i8*, i8** %10
%15 = call i8* @copyByte(i8* %13, i8* %14, i32 4)
store i8* %15, i8** %10
store i8* %4, i8** %9
%16 = load i8*, i8** %9
%17 = load i8*, i8** %10
%18 = call i8* @copyByte(i8* %16, i8* %17, i32 1)
store i8* %18, i8** %10
%19 = bitcast float* %5 to i8*
store i8* %19, i8** %9
%20 = load i8*, i8** %9
%21 = load i8*, i8** %10
%22 = call i8* @copyByte(i8* %20, i8* %21, i32 4)
store i8* %22, i8** %10
%23 = bitcast i16* %6 to i8*
store i8* %23, i8** %9
%24 = load i8*, i8** %9
%25 = load i8*, i8** %10
%26 = call i8* @copyByte(i8* %24, i8* %25, i32 2)
store i8* %26, i8** %10
%27 = bitcast i32* %7 to i8*
store i8* %27, i8** %9
%28 = load i8*, i8** %9
%29 = load i8*, i8** %10
%30 = call i8* @copyByte(i8* %28, i8* %29, i32 4)
store i8* %30, i8** %10
store i32 0, i32* %2
br label %31
31: ; preds = %40, %0
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 15
br i1 %33, label %34, label %43
34: ; preds = %31
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [15 x i8], [15 x i8]* %8, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %38)
br label %40
40: ; preds = %34
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %31
43: ; preds = %31
%44 = getelementptr inbounds [15 x i8], [15 x i8]* %8, i64 0, i64 0
%45 = call i32 @dispArray(i8* %44, i32 15)
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [12 x i8] c"array = %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca i16
%5 = alloca i32
%6 = alloca [15 x i8]
%7 = bitcast i32* %1 to i8*
store i32 305419896, i32* %1
store i8 -102, i8* %2
%8 = bitcast float* %3 to i8*
store float 0x40934A4560000000, float* %3
%9 = bitcast i16* %4 to i8*
store i16 -17186, i16* %4
%10 = bitcast i32* %5 to i8*
store i32 -249346713, i32* %5
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%12 = call i8* @copyByte(i8* %7, i8* %11, i32 4)
%13 = call i8* @copyByte(i8* %2, i8* %12, i32 1)
%14 = call i8* @copyByte(i8* %8, i8* %13, i32 4)
%15 = call i8* @copyByte(i8* %9, i8* %14, i32 2)
%16 = call i8* @copyByte(i8* %10, i8* %15, i32 4)
%17 = load i8, i8* %11
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %17)
%19 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 1
%20 = load i8, i8* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %20)
%22 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 2
%23 = load i8, i8* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %23)
%25 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 3
%26 = load i8, i8* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %26)
%28 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 4
%29 = load i8, i8* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %29)
%31 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 5
%32 = load i8, i8* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %32)
%34 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 6
%35 = load i8, i8* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %35)
%37 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 7
%38 = load i8, i8* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %38)
%40 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 8
%41 = load i8, i8* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %41)
%43 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 9
%44 = load i8, i8* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %44)
%46 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 10
%47 = load i8, i8* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %47)
%49 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 11
%50 = load i8, i8* %49
%51 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %50)
%52 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 12
%53 = load i8, i8* %52
%54 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %53)
%55 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 13
%56 = load i8, i8* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %56)
%58 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 14
%59 = load i8, i8* %58
%60 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %59)
%61 = call i32 @dispArray(i8* %11, i32 15)
ret i32 0
}