#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*/ addTitleElement(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int template_page(char **postvars, int form_method) {
  int i;
  addTitleElement("Blackfin CGI Demo");
  if (form_method == 1) {
    for (i = 0; postvars[i]; i += 2) {
      printf("<li>DEBUG: [%s] = [%s]\n", postvars[i], postvars[i + 1]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<template_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <addTitleElement@plt>
cmpl   $0x1,-0xc(%rbp)
jne    119b <template_page+0x7b>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1196 <template_page+0x76>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
jmp    114c <template_page+0x2c>
jmp    119b <template_page+0x7b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<template_page>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed0(%rip),%rdi
call   1040 <addTitleElement@plt>
cmp    $0x1,%ebp
jne    1168 <template_page+0x48>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1168 <template_page+0x48>
add    $0x10,%rbx
lea    0xec5(%rip),%r14
nopl   (%rax)
mov    -0x8(%rbx),%rdx
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%rsi
add    $0x10,%rbx
test   %rsi,%rsi
jne    1150 <template_page+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Blackfin CGI Demo\00"
@.str.1 = [24 x i8] c"<li>DEBUG: [%s] = [%s]\0A\00"
define i32 @template_page(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%6 = call i32 @addTitleElement(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %34
9: ; preds = %2
store i32 0, i32* %5
br label %10
10: ; preds = %30, %9
%11 = load i8**, i8*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %33
17: ; preds = %10
%18 = load i8**, i8*** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = load i8**, i8*** %3
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %28)
br label %30
30: ; preds = %17
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 2
store i32 %32, i32* %5
br label %10
33: ; preds = %10
br label %34
34: ; preds = %33, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Blackfin CGI Demo\00"
@.str.1 = [24 x i8] c"<li>DEBUG: [%s] = [%s]\0A\00"
define i32 @template_page(i8** nocapture %0, i32 %1) {
%3 = tail call i32 @addTitleElement(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %1, 1
br i1 %4, label %5, label %19
5: ; preds = %2
%6 = load i8*, i8** %0
%7 = icmp eq i8* %6, null
br i1 %7, label %19, label %8
8: ; preds = %5, %8
%9 = phi i64 [ %15, %8 ], [ 0, %5 ]
%10 = phi i8* [ %17, %8 ], [ %6, %5 ]
%11 = or i64 %9, 1
%12 = getelementptr inbounds i8*, i8** %0, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %13)
%15 = add nuw i64 %9, 2
%16 = getelementptr inbounds i8*, i8** %0, i64 %15
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %8
19: ; preds = %8, %5, %2
ret i32 0
}