#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 */
char *render_template_file(char const *, int, char const **, char const **);
char *render_template_file2(const char *filename, int len, const char *data[]) {
  const char *keys[len];
  const char *values[len];
  int i;
  for (i = 0; i < len; i++) {
    keys[i] = (char *)data[i * 2];
    values[i] = (char *)data[i * 2 + 1];
  }
  return render_template_file(filename, len, keys, values);
}


x86 assembly (clang, -O0):
<render_template_file2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c8 <render_template_file2+0xb8>
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    -0x18(%rbp),%rdx
mov    -0x34(%rbp),%esi
shl    $0x1,%esi
movslq %esi,%rsi
mov    (%rdx,%rsi,8),%rsi
movslq -0x34(%rbp),%rdx
mov    %rsi,(%rcx,%rdx,8)
mov    -0x18(%rbp),%rcx
mov    -0x34(%rbp),%edx
shl    $0x1,%edx
add    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rdx
movslq -0x34(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1171 <render_template_file2+0x61>
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%rdx
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <render_template_file@plt>
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_template_file2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdx,%r9
mov    %esi,%r8d
mov    %rsp,%rdx
lea    0xf(,%r8,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,%rsp
test   %esi,%esi
jle    11dc <render_template_file2+0xcc>
cmp    $0x4,%esi
jae    114a <render_template_file2+0x3a>
xor    %r11d,%r11d
jmp    11ab <render_template_file2+0x9b>
mov    %r8d,%r11d
and    $0xfffffffc,%r11d
lea    0x0(,%r8,8),%r10
and    $0xffffffffffffffe0,%r10
xor    %eax,%eax
nop
movups (%r9,%rax,2),%xmm0
movups 0x10(%r9,%rax,2),%xmm1
movups 0x20(%r9,%rax,2),%xmm2
movups 0x30(%r9,%rax,2),%xmm3
movaps %xmm0,%xmm4
movlhps %xmm1,%xmm4
movaps %xmm2,%xmm5
movlhps %xmm3,%xmm5
unpckhpd %xmm1,%xmm0
unpckhpd %xmm3,%xmm2
movaps %xmm4,(%rdx,%rax,1)
movaps %xmm5,0x10(%rdx,%rax,1)
movaps %xmm0,(%rcx,%rax,1)
movaps %xmm2,0x10(%rcx,%rax,1)
add    $0x20,%rax
cmp    %rax,%r10
jne    1160 <render_template_file2+0x50>
cmp    %r8,%r11
je     11dc <render_template_file2+0xcc>
mov    %r11,%rax
shl    $0x4,%rax
add    %rax,%r9
add    $0x8,%r9
nopl   0x0(%rax)
mov    -0x8(%r9),%rax
mov    %rax,(%rdx,%r11,8)
mov    (%r9),%rax
mov    %rax,(%rcx,%r11,8)
add    $0x1,%r11
add    $0x10,%r9
cmp    %r11,%r8
jne    11c0 <render_template_file2+0xb0>
call   1030 <render_template_file@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define i8* @render_template_file2(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %7
%14 = alloca i8*, i64 %12
store i64 %12, i64* %8
%15 = load i32, i32* %5
%16 = zext i32 %15 to i64
%17 = alloca i8*, i64 %16
store i64 %16, i64* %9
store i32 0, i32* %10
br label %18
18: ; preds = %42, %3
%19 = load i32, i32* %10
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %45
22: ; preds = %18
%23 = load i8**, i8*** %6
%24 = load i32, i32* %10
%25 = mul nsw i32 %24, 2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
%28 = load i8*, i8** %27
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %14, i64 %30
store i8* %28, i8** %31
%32 = load i8**, i8*** %6
%33 = load i32, i32* %10
%34 = mul nsw i32 %33, 2
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %32, i64 %36
%38 = load i8*, i8** %37
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %17, i64 %40
store i8* %38, i8** %41
br label %42
42: ; preds = %22
%43 = load i32, i32* %10
%44 = add nsw i32 %43, 1
store i32 %44, i32* %10
br label %18
45: ; preds = %18
%46 = load i8*, i8** %4
%47 = load i32, i32* %5
%48 = call i8* @render_template_file(i8* %46, i32 %47, i8** %14, i8** %17)
%49 = load i8*, i8** %7
ret i8* %48
}

LLVM IR (-O2):
define i8* @render_template_file2(i8* %0, i32 %1, i8** nocapture %2) {
%4 = zext i32 %1 to i64
%5 = alloca i8*, i64 %4
%6 = alloca i8*, i64 %4
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %53
8: ; preds = %3
%9 = icmp ult i32 %1, 4
br i1 %9, label %39, label %10
10: ; preds = %8
%11 = and i64 %4, 4294967292
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %35, %12 ]
%14 = shl nuw nsw i64 %13, 1
%15 = shl i64 %13, 1
%16 = or i64 %15, 4
%17 = getelementptr inbounds i8*, i8** %2, i64 %14
%18 = getelementptr inbounds i8*, i8** %2, i64 %16
%19 = bitcast i8** %17 to <4 x i8*>*
%20 = bitcast i8** %18 to <4 x i8*>*
%21 = load <4 x i8*>, <4 x i8*>* %19
%22 = load <4 x i8*>, <4 x i8*>* %20
%23 = shufflevector <4 x i8*> %21, <4 x i8*> poison, <2 x i32> <i32 0, i32 2>
%24 = shufflevector <4 x i8*> %22, <4 x i8*> poison, <2 x i32> <i32 0, i32 2>
%25 = shufflevector <4 x i8*> %21, <4 x i8*> poison, <2 x i32> <i32 1, i32 3>
%26 = shufflevector <4 x i8*> %22, <4 x i8*> poison, <2 x i32> <i32 1, i32 3>
%27 = getelementptr inbounds i8*, i8** %5, i64 %13
%28 = bitcast i8** %27 to <2 x i8*>*
store <2 x i8*> %23, <2 x i8*>* %28
%29 = getelementptr inbounds i8*, i8** %27, i64 2
%30 = bitcast i8** %29 to <2 x i8*>*
store <2 x i8*> %24, <2 x i8*>* %30
%31 = getelementptr inbounds i8*, i8** %6, i64 %13
%32 = bitcast i8** %31 to <2 x i8*>*
store <2 x i8*> %25, <2 x i8*>* %32
%33 = getelementptr inbounds i8*, i8** %31, i64 2
%34 = bitcast i8** %33 to <2 x i8*>*
store <2 x i8*> %26, <2 x i8*>* %34
%35 = add nuw i64 %13, 4
%36 = icmp eq i64 %35, %11
br i1 %36, label %37, label %12
37: ; preds = %12
%38 = icmp eq i64 %11, %4
br i1 %38, label %53, label %39
39: ; preds = %8, %37
%40 = phi i64 [ 0, %8 ], [ %11, %37 ]
br label %41
41: ; preds = %39, %41
%42 = phi i64 [ %51, %41 ], [ %40, %39 ]
%43 = shl nuw nsw i64 %42, 1
%44 = getelementptr inbounds i8*, i8** %2, i64 %43
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8*, i8** %5, i64 %42
store i8* %45, i8** %46
%47 = or i64 %43, 1
%48 = getelementptr inbounds i8*, i8** %2, i64 %47
%49 = load i8*, i8** %48
%50 = getelementptr inbounds i8*, i8** %6, i64 %42
store i8* %49, i8** %50
%51 = add nuw nsw i64 %42, 1
%52 = icmp eq i64 %51, %4
br i1 %52, label %53, label %41
53: ; preds = %41, %37, %3
%54 = call i8* @render_template_file(i8* %0, i32 %1, i8** %5, i8** %6)
ret i8* %54
}