#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*/ DecodeInstruction(unsigned int, int);
int /*<<< orphan*/ printf(char *, ...);
void Disassemble(unsigned int *armInstruction, int count,
                 unsigned int startAddress) {
  int instrAddress, i;
  for (i = 0; i < count; i++) {
    instrAddress = startAddress + i * 4;
    printf("0x%08X: 0x%08X\t", instrAddress, armInstruction[i]);
    DecodeInstruction(armInstruction[i], instrAddress);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<Disassemble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119e <Disassemble+0x7e>
mov    -0x10(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x14(%rbp),%esi
call   1040 <DecodeInstruction@plt>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1139 <Disassemble+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Disassemble>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1194 <Disassemble+0x64>
mov    %rdi,%r13
mov    %esi,%r15d
mov    %edx,%r12d
shl    $0x2,%r15
lea    0xead(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%r12,%rbx,1),%ebp
mov    0x0(%r13,%rbx,1),%edx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%r13,%rbx,1),%edi
mov    %ebp,%esi
call   1050 <DecodeInstruction@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x4,%rbx
cmp    %rbx,%r15
jne    1160 <Disassemble+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"0x%08X: 0x%08X\09\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @Disassemble(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
br label %9
9: ; preds = %33, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %36
13: ; preds = %9
%14 = load i32, i32* %6
%15 = load i32, i32* %8
%16 = mul nsw i32 %15, 4
%17 = add i32 %14, %16
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = load i32*, i32** %4
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %23)
%25 = load i32*, i32** %4
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = load i32, i32* %7
%31 = call i32 @DecodeInstruction(i32 %29, i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %13
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %9
36: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"0x%08X: 0x%08X\09\00"
define void @Disassemble(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %20
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %18, %7 ]
%9 = trunc i64 %8 to i32
%10 = shl i32 %9, 2
%11 = add i32 %10, %2
%12 = getelementptr inbounds i32, i32* %0, i64 %8
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13)
%15 = load i32, i32* %12
%16 = tail call i32 @DecodeInstruction(i32 %15, i32 %11)
%17 = tail call i32 @putchar(i32 10)
%18 = add nuw nsw i64 %8, 1
%19 = icmp eq i64 %18, %6
br i1 %19, label %20, label %7
20: ; preds = %7, %3
ret void
}