#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ull_to_bytes(unsigned char *, int, int /*<<< orphan*/ const);
void addr_to_bytes(unsigned char *bytes, const uint32_t addr[8]) {
  int i;
  for (i = 0; i < 8; i++) {
    ull_to_bytes(bytes + i * 4, 4, addr[i]);
  }
}


x86 assembly (clang, -O0):
<addr_to_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1163 <addr_to_bytes+0x53>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    $0x4,%esi
call   1030 <ull_to_bytes@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <addr_to_bytes+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addr_to_bytes>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rsi),%edx
mov    $0x4,%esi
call   1030 <ull_to_bytes@plt>
lea    0x4(%rbx),%rdi
mov    0x4(%r14),%edx
mov    $0x4,%esi
call   1030 <ull_to_bytes@plt>
lea    0x8(%rbx),%rdi
mov    0x8(%r14),%edx
mov    $0x4,%esi
call   1030 <ull_to_bytes@plt>
lea    0xc(%rbx),%rdi
mov    0xc(%r14),%edx
mov    $0x4,%esi
call   1030 <ull_to_bytes@plt>
lea    0x10(%rbx),%rdi
mov    0x10(%r14),%edx
mov    $0x4,%esi
call   1030 <ull_to_bytes@plt>
lea    0x14(%rbx),%rdi
mov    0x14(%r14),%edx
mov    $0x4,%esi
call   1030 <ull_to_bytes@plt>
lea    0x18(%rbx),%rdi
mov    0x18(%r14),%edx
mov    $0x4,%esi
call   1030 <ull_to_bytes@plt>
add    $0x1c,%rbx
mov    0x1c(%r14),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ull_to_bytes@plt>

LLVM IR (-O0):
define void @addr_to_bytes(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %6
6: ; preds = %21, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = load i32, i32* %5
%12 = mul nsw i32 %11, 4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = call i32 @ull_to_bytes(i8* %14, i32 4, i32 %19)
br label %21
21: ; preds = %9
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @addr_to_bytes(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = tail call i32 @ull_to_bytes(i8* %0, i32 4, i32 %3)
%5 = getelementptr inbounds i8, i8* %0, i64 4
%6 = getelementptr inbounds i32, i32* %1, i64 1
%7 = load i32, i32* %6
%8 = tail call i32 @ull_to_bytes(i8* %5, i32 4, i32 %7)
%9 = getelementptr inbounds i8, i8* %0, i64 8
%10 = getelementptr inbounds i32, i32* %1, i64 2
%11 = load i32, i32* %10
%12 = tail call i32 @ull_to_bytes(i8* %9, i32 4, i32 %11)
%13 = getelementptr inbounds i8, i8* %0, i64 12
%14 = getelementptr inbounds i32, i32* %1, i64 3
%15 = load i32, i32* %14
%16 = tail call i32 @ull_to_bytes(i8* %13, i32 4, i32 %15)
%17 = getelementptr inbounds i8, i8* %0, i64 16
%18 = getelementptr inbounds i32, i32* %1, i64 4
%19 = load i32, i32* %18
%20 = tail call i32 @ull_to_bytes(i8* %17, i32 4, i32 %19)
%21 = getelementptr inbounds i8, i8* %0, i64 20
%22 = getelementptr inbounds i32, i32* %1, i64 5
%23 = load i32, i32* %22
%24 = tail call i32 @ull_to_bytes(i8* %21, i32 4, i32 %23)
%25 = getelementptr inbounds i8, i8* %0, i64 24
%26 = getelementptr inbounds i32, i32* %1, i64 6
%27 = load i32, i32* %26
%28 = tail call i32 @ull_to_bytes(i8* %25, i32 4, i32 %27)
%29 = getelementptr inbounds i8, i8* %0, i64 28
%30 = getelementptr inbounds i32, i32* %1, i64 7
%31 = load i32, i32* %30
%32 = tail call i32 @ull_to_bytes(i8* %29, i32 4, i32 %31)
ret void
}