#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*/ Elf64_Addr;

/* Variables and functions */
int /*<<< orphan*/ beginblock(int);
int /*<<< orphan*/ endblock();
int /*<<< orphan*/ out(int /*<<< orphan*/);
int /*<<< orphan*/ straddress(int /*<<< orphan*/ const);
void outaddr64(void const *ptr, long size, int ndx) {
  Elf64_Addr const *addrs = ptr;
  long count = size / sizeof *addrs;
  long i;
  (void)ndx;
  beginblock(1);
  for (i = 0; i < count; ++i)
    (out(straddress(addrs[i])));
  endblock();
}


x86 assembly (clang, -O0):
<outaddr64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x2,%rax
mov    %rax,-0x28(%rbp)
mov    $0x1,%edi
call   1040 <beginblock@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    11af <outaddr64+0x6f>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1060 <straddress@plt>
mov    %eax,%edi
call   1050 <out@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1179 <outaddr64+0x39>
mov    $0x0,%al
call   1030 <endblock@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outaddr64>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0x1,%edi
call   1040 <beginblock@plt>
cmp    $0x4,%r15
jb     1189 <outaddr64+0x49>
shr    $0x2,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
call   1060 <straddress@plt>
mov    %eax,%edi
call   1050 <out@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <outaddr64+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <endblock@plt>

LLVM IR (-O0):
define void @outaddr64(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %7
%12 = load i64, i64* %5
%13 = udiv i64 %12, 4
store i64 %13, i64* %8
%14 = load i32, i32* %6
%15 = call i32 @beginblock(i32 1)
store i64 0, i64* %9
br label %16
16: ; preds = %27, %3
%17 = load i64, i64* %9
%18 = load i64, i64* %8
%19 = icmp slt i64 %17, %18
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i32*, i32** %7
%22 = load i64, i64* %9
%23 = getelementptr inbounds i32, i32* %21, i64 %22
%24 = load i32, i32* %23
%25 = call i32 @straddress(i32 %24)
%26 = call i32 @out(i32 %25)
br label %27
27: ; preds = %20
%28 = load i64, i64* %9
%29 = add nsw i64 %28, 1
store i64 %29, i64* %9
br label %16
30: ; preds = %16
%31 = call i32 (...) @endblock()
ret void
}

LLVM IR (-O2):
define void @outaddr64(i8* nocapture %0, i64 %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @beginblock(i32 1)
%6 = icmp ult i64 %1, 4
br i1 %6, label %17, label %7
7: ; preds = %3
%8 = lshr i64 %1, 2
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ %15, %9 ], [ 0, %7 ]
%11 = getelementptr inbounds i32, i32* %4, i64 %10
%12 = load i32, i32* %11
%13 = tail call i32 @straddress(i32 %12)
%14 = tail call i32 @out(i32 %13)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %3
%18 = tail call i32 (...) @endblock()
ret void
}