#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void output_table(uint32_t table[], int len, const char *trans) {
  int i;
  for (i = 0; i < len - 1; i++) {
    if (i % 4 == 0)
      printf("\n");
    printf("%s(0x%8.8xL), ", trans, table[i]);
  }
  printf("%s(0x%8.8xL)\n", trans, table[len - 1]);
}


x86 assembly (clang, -O0):
<output_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1188 <output_table+0x78>
mov    -0x1c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115d <output_table+0x4d>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <output_table+0x1a>
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%r13
lea    -0x1(%rsi),%r12d
cmp    $0x2,%esi
jl     117c <output_table+0x5c>
mov    %r12d,%ebp
lea    0xebc(%rip),%r15
xor    %ebx,%ebx
jmp    116b <output_table+0x4b>
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,4),%edx
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     117c <output_table+0x5c>
test   $0x3,%bl
jne    1150 <output_table+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <output_table+0x30>
movslq %r12d,%rax
mov    0x0(%r13,%rax,4),%edx
lea    0xe84(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

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

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