#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*/ c40_printf(char *, ...);
void dump(unsigned long parms[]) {
  int i;
  if (parms[1] == 0xFFFFFFFF)
    return;
  while (parms[1]) {
    c40_printf("\n[%x]   ", parms[0]);
    for (i = 0; i < 4; i++) {
      c40_printf("%x  ", *((unsigned long *)parms[0]++));
      if (!(--parms[1]))
        break;
    }
  }
  c40_printf("\n\n");
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xffffffff,%ecx
cmp    %rcx,0x8(%rax)
jne    1134 <dump+0x24>
jmp    11d5 <dump+0xc5>
jmp    1139 <dump+0x29>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11c7 <dump+0xb7>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <c40_printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11c2 <dump+0xb2>
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
mov    (%rax),%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <c40_printf@plt>
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,0x8(%rcx)
cmp    $0x0,%rax
jne    11af <dump+0x9f>
jmp    11c2 <dump+0xb2>
jmp    11b4 <dump+0xa4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <dump+0x54>
jmp    1139 <dump+0x29>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <c40_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x8(%rdi),%rax
test   %rax,%rax
je     11a5 <dump+0x95>
mov    $0xffffffff,%ecx
cmp    %rcx,%rax
jne    113b <dump+0x2b>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rdi,%r12
lea    0xebb(%rip),%r14
lea    0xebd(%rip),%r15
jmp    1155 <dump+0x45>
xchg   %ax,%ax
test   %rax,%rax
je     11a5 <dump+0x95>
mov    (%r12),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <c40_printf@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r12)
mov    (%rax),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <c40_printf@plt>
mov    0x8(%r12),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,0x8(%r12)
je     1150 <dump+0x40>
lea    0x1(%rbx),%ecx
cmp    $0x3,%ebx
mov    %ecx,%ebx
jb     1170 <dump+0x60>
jmp    1150 <dump+0x40>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <c40_printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"\0A[%x] \00"
@.str.1 = [5 x i8] c"%x \00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define void @dump(i64* %0) {
%2 = alloca i64*
%3 = alloca i32
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = getelementptr inbounds i64, i64* %4, i64 1
%6 = load i64, i64* %5
%7 = icmp eq i64 %6, 4294967295
br i1 %7, label %8, label %9
8: ; preds = %1
br label %44
9: ; preds = %1
br label %10
10: ; preds = %41, %9
%11 = load i64*, i64** %2
%12 = getelementptr inbounds i64, i64* %11, i64 1
%13 = load i64, i64* %12
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %42
15: ; preds = %10
%16 = load i64*, i64** %2
%17 = getelementptr inbounds i64, i64* %16, i64 0
%18 = load i64, i64* %17
%19 = call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %18)
store i32 0, i32* %3
br label %20
20: ; preds = %38, %15
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 4
br i1 %22, label %23, label %41
23: ; preds = %20
%24 = load i64*, i64** %2
%25 = getelementptr inbounds i64, i64* %24, i64 0
%26 = load i64, i64* %25
%27 = add i64 %26, 1
store i64 %27, i64* %25
%28 = inttoptr i64 %26 to i64*
%29 = load i64, i64* %28
%30 = call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %29)
%31 = load i64*, i64** %2
%32 = getelementptr inbounds i64, i64* %31, i64 1
%33 = load i64, i64* %32
%34 = add i64 %33, -1
store i64 %34, i64* %32
%35 = icmp ne i64 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %23
br label %41
37: ; preds = %23
br label %38
38: ; preds = %37
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %20
41: ; preds = %36, %20
br label %10
42: ; preds = %10
%43 = call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42, %8
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"\0A[%x] \00"
@.str.1 = [5 x i8] c"%x \00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define void @dump(i64* nocapture %0) {
%2 = getelementptr inbounds i64, i64* %0, i64 1
%3 = load i64, i64* %2
switch i64 %3, label %4 [
i64 4294967295, label %24
i64 0, label %22
]
4: ; preds = %1, %20
%5 = load i64, i64* %0
%6 = tail call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %5)
br label %7
7: ; preds = %7, %4
%8 = phi i32 [ 0, %4 ], [ %17, %7 ]
%9 = load i64, i64* %0
%10 = add i64 %9, 1
store i64 %10, i64* %0
%11 = inttoptr i64 %9 to i64*
%12 = load i64, i64* %11
%13 = tail call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %12)
%14 = load i64, i64* %2
%15 = add i64 %14, -1
store i64 %15, i64* %2
%16 = icmp ne i64 %15, 0
%17 = add nuw nsw i32 %8, 1
%18 = icmp ult i32 %8, 3
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %7, label %20
20: ; preds = %7
%21 = icmp eq i64 %15, 0
br i1 %21, label %22, label %4
22: ; preds = %20, %1
%23 = tail call i32 (i8*, ...) @c40_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %1, %22
ret void
}