#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;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void export_cnf_table(FILE *f, uint32_t cnf[256], const char *name) {
  uint32_t i;
  fprintf(f, "static const uint32_t %s[256] = {\n", name);
  for (i = 0; i < 256; i += 4) {
    fprintf(f, "  0x%08x, 0x%08x, 0x%08x, 0x%08x,\n", cnf[i], cnf[i + 1],
            cnf[i + 2], cnf[i + 3]);
  }
  fprintf(f, "};\n\n");
}


x86 assembly (clang, -O0):
<export_cnf_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jge    11ab <export_cnf_table+0x9b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%esi
add    $0x2,%esi
movslq %esi,%rsi
mov    (%rax,%rsi,4),%r8d
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%esi
add    $0x3,%esi
movslq %esi,%rsi
mov    (%rax,%rsi,4),%r9d
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <export_cnf_table+0x31>
mov    -0x8(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<export_cnf_table>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xecb(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xfffffffffffffffc,%rbx
lea    0xed9(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    0x10(%r12,%rbx,4),%edx
mov    0x14(%r12,%rbx,4),%ecx
mov    0x18(%r12,%rbx,4),%r8d
mov    0x1c(%r12,%rbx,4),%r9d
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x4,%rbx
cmp    $0xfc,%rbx
jb     1150 <export_cnf_table+0x30>
lea    0xec1(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"static const uint32_t %s[256] = {\0A\00"
@.str.1 = [35 x i8] c" 0x%08x, 0x%08x, 0x%08x, 0x%08x,\0A\00"
@.str.2 = [5 x i8] c"};\0A\0A\00"
define void @export_cnf_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
%8 = load i32*, i32** %4
%9 = load i8*, i8** %6
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %9)
store i32 0, i32* %7
br label %11
11: ; preds = %40, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 256
br i1 %13, label %14, label %43
14: ; preds = %11
%15 = load i32*, i32** %4
%16 = load i32*, i32** %5
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = load i32*, i32** %5
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %21, i64 %24
%26 = load i32, i32* %25
%27 = load i32*, i32** %5
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %27, i64 %30
%32 = load i32, i32* %31
%33 = load i32*, i32** %5
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %33, i64 %36
%38 = load i32, i32* %37
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %26, i32 %32, i32 %38)
br label %40
40: ; preds = %14
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 4
store i32 %42, i32* %7
br label %11
43: ; preds = %11
%44 = load i32*, i32** %4
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"static const uint32_t %s[256] = {\0A\00"
@.str.1 = [35 x i8] c" 0x%08x, 0x%08x, 0x%08x, 0x%08x,\0A\00"
@.str.2 = [5 x i8] c"};\0A\0A\00"
define void @export_cnf_table(i32* nocapture %0, i32* nocapture %1, i8* %2) {
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ 0, %3 ], [ %19, %5 ]
%7 = getelementptr inbounds i32, i32* %1, i64 %6
%8 = load i32, i32* %7
%9 = or i64 %6, 1
%10 = getelementptr inbounds i32, i32* %1, i64 %9
%11 = load i32, i32* %10
%12 = or i64 %6, 2
%13 = getelementptr inbounds i32, i32* %1, i64 %12
%14 = load i32, i32* %13
%15 = or i64 %6, 3
%16 = getelementptr inbounds i32, i32* %1, i64 %15
%17 = load i32, i32* %16
%18 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %11, i32 %14, i32 %17)
%19 = add nuw nsw i64 %6, 4
%20 = icmp ult i64 %6, 252
br i1 %20, label %5, label %21
21: ; preds = %5
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 4, i64 1, i32* %0)
ret void
}