#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*/ printf(char *, ...);
void make_array(char *name, unsigned long *d, int len) {
  int i;
  printf("\n");
  printf("static const u32 %s[] = {\n", name);
  for (i = 0; i < len; i++) {
    if (i == 0) {
      printf("\t");
    } else if (i % 4 == 0) {
      printf(",\n\t");
    } else {
      printf(", ");
    }
    printf("C32(0x%08lX)", d[i]);
  }
  printf("\n};\n");
}


x86 assembly (clang, -O0):
<make_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d5 <make_array+0xc5>
cmpl   $0x0,-0x18(%rbp)
jne    1173 <make_array+0x63>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ad <make_array+0x9d>
mov    -0x18(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119a <make_array+0x8a>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a8 <make_array+0x98>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ad <make_array+0x9d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <make_array+0x3a>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeab(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    11d8 <make_array+0xa8>
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    (%r15),%rsi
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1,%r14d
je     11d8 <make_array+0xa8>
mov    %r14d,%ebp
mov    $0x1,%ebx
lea    0xe87(%rip),%r12
lea    0xe84(%rip),%r13
lea    0xe80(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   $0x3,%bl
mov    %r13,%rdi
cmove  %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11b0 <make_array+0x80>
lea    0xe50(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

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