#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 */
struct NameValuePair {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ appendNameValuePair(struct NameValuePair **,
                                       struct NameValuePair *);
int /*<<< orphan*/ free(char *);
int getConfigInt(char *, int);
char *getConfigText(char *, int);
int /*<<< orphan*/ getDailyItems(char **, int, char *);
int /*<<< orphan*/ getHourlyItems(char **, int, char *);
char *getPubDate(int);
struct NameValuePair *makeNameValuePair(char *, char *);
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
scalar_t__ strlen(char *);
struct NameValuePair *makeRssRequestValues() {
  char *serverName = getConfigText("web.server_name", 1);
  char *title;
  if ((serverName != NULL) && (strlen(serverName) > 0)) {
    title = malloc(strlen("BitMeter OS Events") + 3 + strlen(serverName) + 1);
    sprintf(title, "%s - %s", "BitMeter OS Events", serverName);
  } else {
    title = strdup("BitMeter OS Events");
  }
  if (serverName != NULL) {
    free(serverName);
  }
  char *rssHost = getConfigText("web.rss.host", 1);
  if ((rssHost == NULL) || (strlen(rssHost) == 0)) {
    if (rssHost != NULL) {
      free(rssHost);
    }
    rssHost = strdup("localhost");
  }
  int rssPort = getConfigInt("web.port", 1);
  if (rssPort < 1 || rssPort > 65535) {
    rssPort = 2605;
  }
  char rssUrl[7 + strlen(rssHost) + 1 + 5 + 1];
  sprintf(rssUrl, "http://%s:%d", rssHost, rssPort);
  if (rssHost != NULL) {
    free(rssHost);
  }
  int rssFreq = getConfigInt("web.rss.freq", 1);
  if ((rssFreq != 1) && (rssFreq != 2)) {
    rssFreq = 1;
  }
  int rssItemCount = getConfigInt("web.rss.items", 1);
  if (rssItemCount < 1) {
    rssItemCount = 10;
  }
  char *items[rssItemCount];
  if (rssFreq == 2) {
    getHourlyItems(items, rssItemCount, rssUrl);
  } else {
    getDailyItems(items, rssItemCount, rssUrl);
  }
  int i, size = 0;
  for (i = 0; i < rssItemCount; i++) {
    size += strlen(items[i]);
  }
  char *itemsTxt = malloc(size + 1);
  int j, offset = 0;
  char *itemTxt;
  for (j = 0; j < rssItemCount; j++) {
    itemTxt = items[j];
    strcpy(itemsTxt + offset, itemTxt);
    offset += strlen(itemTxt);
    free(itemTxt);
  }
  itemsTxt[size] = 0;
  char *pubDate = getPubDate(rssFreq);
  char *ttlTxt = (rssFreq == 2) ? "60" : "1440";
  char *freqTxt = (rssFreq == 2) ? "hourly" : "daily";
  struct NameValuePair *pair = makeNameValuePair("title", title);
  appendNameValuePair(&pair, makeNameValuePair("link", rssUrl));
  appendNameValuePair(&pair, makeNameValuePair("pubdate", pubDate));
  appendNameValuePair(&pair, makeNameValuePair("items", itemsTxt));
  appendNameValuePair(&pair, makeNameValuePair("ttl", ttlTxt));
  appendNameValuePair(&pair, makeNameValuePair("freq", freqTxt));
  free(title);
  free(pubDate);
  free(itemsTxt);
  return pair;
}


x86 assembly (clang, -O0):
<makeRssRequestValues>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    0xe1e(%rip),%rdi
mov    $0x1,%esi
call   1050 <getConfigText@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     126c <makeRssRequestValues+0x9c>
mov    -0x8(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%rax
jle    126c <makeRssRequestValues+0x9c>
lea    0xdfb(%rip),%rdi
call   1070 <strlen@plt>
add    $0x3,%rax
mov    %rax,-0x88(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,%rcx
mov    -0x88(%rbp),%rax
add    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
lea    0xdca(%rip),%rsi
lea    0xdb0(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    127c <makeRssRequestValues+0xac>
lea    0xd9d(%rip),%rdi
call   10e0 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1290 <makeRssRequestValues+0xc0>
mov    -0x8(%rbp),%rdi
call   1040 <free@plt>
lea    0xd94(%rip),%rdi
mov    $0x1,%esi
call   1050 <getConfigText@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     12c3 <makeRssRequestValues+0xf3>
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%rax
jne    12e7 <makeRssRequestValues+0x117>
cmpq   $0x0,-0x18(%rbp)
je     12d7 <makeRssRequestValues+0x107>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
lea    0xd5a(%rip),%rdi
call   10e0 <strdup@plt>
mov    %rax,-0x18(%rbp)
lea    0xd54(%rip),%rdi
mov    $0x1,%esi
call   1030 <getConfigInt@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jl     1312 <makeRssRequestValues+0x142>
cmpl   $0xffff,-0x1c(%rbp)
jle    1319 <makeRssRequestValues+0x149>
movl   $0xa2d,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,%rcx
mov    %rcx,%rax
add    $0xe,%rax
mov    %rsp,%rdx
mov    %rdx,-0x28(%rbp)
add    $0x1d,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x90(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xcee(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
cmpq   $0x0,-0x18(%rbp)
je     1378 <makeRssRequestValues+0x1a8>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
lea    0xcd9(%rip),%rdi
mov    $0x1,%esi
call   1030 <getConfigInt@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
je     13a7 <makeRssRequestValues+0x1d7>
cmpl   $0x2,-0x34(%rbp)
je     13a7 <makeRssRequestValues+0x1d7>
movl   $0x1,-0x34(%rbp)
lea    0xcb7(%rip),%rdi
mov    $0x1,%esi
call   1030 <getConfigInt@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x1,-0x38(%rbp)
jge    13cc <makeRssRequestValues+0x1fc>
movl   $0xa,-0x38(%rbp)
mov    -0x38(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
cmpl   $0x2,-0x34(%rbp)
jne    1414 <makeRssRequestValues+0x244>
mov    -0x90(%rbp),%rdx
mov    -0x98(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1080 <getHourlyItems@plt>
jmp    142a <makeRssRequestValues+0x25a>
mov    -0x90(%rbp),%rdx
mov    -0x98(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   10b0 <getDailyItems@plt>
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1473 <makeRssRequestValues+0x2a3>
mov    -0x98(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1438 <makeRssRequestValues+0x268>
mov    -0x48(%rbp),%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    14f0 <makeRssRequestValues+0x320>
mov    -0x98(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%rdi
movslq -0x58(%rbp),%rax
add    %rax,%rdi
mov    -0x60(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x60(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x60(%rbp),%rdi
call   1040 <free@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1490 <makeRssRequestValues+0x2c0>
mov    -0x50(%rbp),%rax
movslq -0x48(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x34(%rbp),%edi
call   10a0 <getPubDate@plt>
mov    %rax,-0x68(%rbp)
mov    -0x34(%rbp),%edx
lea    0xb64(%rip),%rax
lea    0xb5a(%rip),%rcx
cmp    $0x2,%edx
cmove  %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x34(%rbp),%edx
lea    0xb54(%rip),%rax
lea    0xb46(%rip),%rcx
cmp    $0x2,%edx
cmove  %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xb3d(%rip),%rdi
call   10d0 <makeNameValuePair@plt>
mov    -0x90(%rbp),%rsi
mov    %rax,-0x80(%rbp)
lea    0xb2c(%rip),%rdi
call   10d0 <makeNameValuePair@plt>
mov    %rax,%rsi
lea    -0x80(%rbp),%rdi
call   10f0 <appendNameValuePair@plt>
mov    -0x68(%rbp),%rsi
lea    0xb15(%rip),%rdi
call   10d0 <makeNameValuePair@plt>
mov    %rax,%rsi
lea    -0x80(%rbp),%rdi
call   10f0 <appendNameValuePair@plt>
mov    -0x50(%rbp),%rsi
lea    0xad3(%rip),%rdi
call   10d0 <makeNameValuePair@plt>
mov    %rax,%rsi
lea    -0x80(%rbp),%rdi
call   10f0 <appendNameValuePair@plt>
mov    -0x70(%rbp),%rsi
lea    0xae5(%rip),%rdi
call   10d0 <makeNameValuePair@plt>
mov    %rax,%rsi
lea    -0x80(%rbp),%rdi
call   10f0 <appendNameValuePair@plt>
mov    -0x78(%rbp),%rsi
lea    0xa8e(%rip),%rdi
call   10d0 <makeNameValuePair@plt>
mov    %rax,%rsi
lea    -0x80(%rbp),%rdi
call   10f0 <appendNameValuePair@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
mov    -0x68(%rbp),%rdi
call   1040 <free@plt>
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
mov    -0x80(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeRssRequestValues>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe18(%rip),%rdi
mov    $0x1,%esi
call   1050 <getConfigText@plt>
test   %rax,%rax
je     1232 <makeRssRequestValues+0x62>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <strlen@plt>
test   %rax,%rax
jle    1244 <makeRssRequestValues+0x74>
add    $0x16,%eax
mov    %eax,%edi
call   1090 <malloc@plt>
lea    0xe0b(%rip),%rsi
lea    0xdf1(%rip),%rdx
mov    %rax,-0x30(%rbp)
mov    %rax,%rdi
mov    %rbx,%rcx
xor    %eax,%eax
call   10c0 <sprintf@plt>
jmp    1254 <makeRssRequestValues+0x84>
lea    0xdd7(%rip),%rdi
call   10e0 <strdup@plt>
mov    %rax,-0x30(%rbp)
jmp    125c <makeRssRequestValues+0x8c>
lea    0xdc5(%rip),%rdi
call   10e0 <strdup@plt>
mov    %rax,-0x30(%rbp)
mov    %rbx,%rdi
call   1040 <free@plt>
lea    0xdc8(%rip),%rdi
mov    $0x1,%esi
call   1050 <getConfigText@plt>
test   %rax,%rax
je     1282 <makeRssRequestValues+0xb2>
mov    %rax,%rbx
cmpb   $0x0,(%rax)
jne    1291 <makeRssRequestValues+0xc1>
mov    %rbx,%rdi
call   1040 <free@plt>
lea    0xdaf(%rip),%rdi
call   10e0 <strdup@plt>
mov    %rax,%rbx
lea    0xdaa(%rip),%rdi
mov    $0x1,%r15d
mov    $0x1,%esi
call   1030 <getConfigInt@plt>
lea    -0x10000(%rax),%ecx
cmp    $0xffff0001,%ecx
mov    $0xa2d,%r14d
cmovae %eax,%r14d
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %rsp,%r12
add    $0x1d,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xd6d(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %r14d,%ecx
xor    %eax,%eax
call   10c0 <sprintf@plt>
test   %rbx,%rbx
je     12fb <makeRssRequestValues+0x12b>
mov    %rbx,%rdi
call   1040 <free@plt>
lea    0xd56(%rip),%rdi
mov    $0x1,%esi
call   1030 <getConfigInt@plt>
mov    %eax,%ebx
lea    -0x3(%rbx),%eax
cmp    $0xfffffffe,%eax
cmovb  %r15d,%ebx
lea    0xd46(%rip),%rdi
mov    $0x1,%esi
call   1030 <getConfigInt@plt>
test   %eax,%eax
mov    $0xa,%r14d
cmovg  %eax,%r14d
lea    0xf(,%r14,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r15
sub    %rax,%r15
mov    %r15,%rsp
mov    %rbx,-0x48(%rbp)
mov    %r15,%rdi
mov    %r14d,%esi
mov    %r12,%rdx
cmp    $0x2,%ebx
jne    1363 <makeRssRequestValues+0x193>
call   1080 <getHourlyItems@plt>
jmp    1368 <makeRssRequestValues+0x198>
call   10b0 <getDailyItems@plt>
xor    %ebx,%ebx
xor    %r13d,%r13d
nopl   (%rax)
mov    (%r15,%rbx,8),%rdi
call   1070 <strlen@plt>
add    %eax,%r13d
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1370 <makeRssRequestValues+0x1a0>
mov    %r12,-0x50(%rbp)
lea    0x1(%r13),%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
xor    %ebx,%ebx
mov    %r15,-0x58(%rbp)
xor    %r15d,%r15d
mov    %r14,-0x60(%rbp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    -0x58(%rbp),%rax
mov    (%rax,%rbx,8),%r12
movslq %r15d,%r14
mov    -0x38(%rbp),%rax
lea    (%rax,%r14,1),%rdi
mov    %r12,%rsi
call   1060 <strcpy@plt>
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %rax,%r15
add    %r14,%r15
mov    -0x60(%rbp),%r14
mov    %r12,%rdi
call   1040 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    13b0 <makeRssRequestValues+0x1e0>
movslq %r13d,%rax
mov    -0x38(%rbp),%r14
movb   $0x0,(%r14,%rax,1)
mov    -0x48(%rbp),%rbx
mov    %ebx,%edi
call   10a0 <getPubDate@plt>
mov    %rax,%r13
cmp    $0x2,%ebx
lea    0xc61(%rip),%rax
lea    0xc5d(%rip),%rbx
cmove  %rax,%rbx
lea    0xc57(%rip),%rax
lea    0xc57(%rip),%r12
cmove  %rax,%r12
lea    0xc52(%rip),%rdi
mov    -0x30(%rbp),%rsi
call   10d0 <makeNameValuePair@plt>
mov    %rax,-0x40(%rbp)
lea    0xc44(%rip),%rdi
mov    -0x50(%rbp),%rsi
call   10d0 <makeNameValuePair@plt>
lea    -0x40(%rbp),%r15
mov    %r15,%rdi
mov    %rax,%rsi
call   10f0 <appendNameValuePair@plt>
lea    0xc2a(%rip),%rdi
mov    %r13,%rsi
call   10d0 <makeNameValuePair@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   10f0 <appendNameValuePair@plt>
lea    0xbea(%rip),%rdi
mov    %r14,%rsi
call   10d0 <makeNameValuePair@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   10f0 <appendNameValuePair@plt>
lea    0xbfe(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <makeNameValuePair@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   10f0 <appendNameValuePair@plt>
lea    0xba9(%rip),%rdi
mov    %r12,%rsi
call   10d0 <makeNameValuePair@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   10f0 <appendNameValuePair@plt>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    %r13,%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1040 <free@plt>
mov    -0x40(%rbp),%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.NameValuePair = type { i32 }
@.str = [16 x i8] c"web.server_name\00"
@.str.1 = [19 x i8] c"BitMeter OS Events\00"
@.str.2 = [8 x i8] c"%s - %s\00"
@.str.3 = [13 x i8] c"web.rss.host\00"
@.str.4 = [10 x i8] c"localhost\00"
@.str.5 = [9 x i8] c"web.port\00"
@.str.6 = [13 x i8] c"http://%s:%d\00"
@.str.7 = [13 x i8] c"web.rss.freq\00"
@.str.8 = [14 x i8] c"web.rss.items\00"
@.str.9 = [3 x i8] c"60\00"
@.str.10 = [5 x i8] c"1440\00"
@.str.11 = [7 x i8] c"hourly\00"
@.str.12 = [6 x i8] c"daily\00"
@.str.13 = [6 x i8] c"title\00"
@.str.14 = [5 x i8] c"link\00"
@.str.15 = [8 x i8] c"pubdate\00"
@.str.16 = [6 x i8] c"items\00"
@.str.17 = [4 x i8] c"ttl\00"
@.str.18 = [5 x i8] c"freq\00"
define %struct.NameValuePair* @makeRssRequestValues() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca %struct.NameValuePair*
%20 = call i8* @getConfigText(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
store i8* %20, i8** %1
%21 = load i8*, i8** %1
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %39
23: ; preds = %0
%24 = load i8*, i8** %1
%25 = call i64 @strlen(i8* %24)
%26 = icmp sgt i64 %25, 0
br i1 %26, label %27, label %39
27: ; preds = %23
%28 = call i64 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%29 = add nsw i64 %28, 3
%30 = load i8*, i8** %1
%31 = call i64 @strlen(i8* %30)
%32 = add nsw i64 %29, %31
%33 = add nsw i64 %32, 1
%34 = trunc i64 %33 to i32
%35 = call i8* @malloc(i32 %34)
store i8* %35, i8** %2
%36 = load i8*, i8** %2
%37 = load i8*, i8** %1
%38 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %36, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %37)
br label %41
39: ; preds = %23, %0
%40 = call i8* @strdup(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i8* %40, i8** %2
br label %41
41: ; preds = %39, %27
%42 = load i8*, i8** %1
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i8*, i8** %1
%46 = call i32 @free(i8* %45)
br label %47
47: ; preds = %44, %41
%48 = call i8* @getConfigText(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 1)
store i8* %48, i8** %3
%49 = load i8*, i8** %3
%50 = icmp eq i8* %49, null
br i1 %50, label %55, label %51
51: ; preds = %47
%52 = load i8*, i8** %3
%53 = call i64 @strlen(i8* %52)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %63
55: ; preds = %51, %47
%56 = load i8*, i8** %3
%57 = icmp ne i8* %56, null
br i1 %57, label %58, label %61
58: ; preds = %55
%59 = load i8*, i8** %3
%60 = call i32 @free(i8* %59)
br label %61
61: ; preds = %58, %55
%62 = call i8* @strdup(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
store i8* %62, i8** %3
br label %63
63: ; preds = %61, %51
%64 = call i32 @getConfigInt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 1)
store i32 %64, i32* %4
%65 = load i32, i32* %4
%66 = icmp slt i32 %65, 1
br i1 %66, label %70, label %67
67: ; preds = %63
%68 = load i32, i32* %4
%69 = icmp sgt i32 %68, 65535
br i1 %69, label %70, label %71
70: ; preds = %67, %63
store i32 2605, i32* %4
br label %71
71: ; preds = %70, %67
%72 = load i8*, i8** %3
%73 = call i64 @strlen(i8* %72)
%74 = add nsw i64 7, %73
%75 = add nsw i64 %74, 1
%76 = add nsw i64 %75, 5
%77 = add nsw i64 %76, 1
%78 = call i8* @llvm.stacksave()
store i8* %78, i8** %5
%79 = alloca i8, i64 %77
store i64 %77, i64* %6
%80 = load i8*, i8** %3
%81 = load i32, i32* %4
%82 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %79, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %80, i32 %81)
%83 = load i8*, i8** %3
%84 = icmp ne i8* %83, null
br i1 %84, label %85, label %88
85: ; preds = %71
%86 = load i8*, i8** %3
%87 = call i32 @free(i8* %86)
br label %88
88: ; preds = %85, %71
%89 = call i32 @getConfigInt(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 1)
store i32 %89, i32* %7
%90 = load i32, i32* %7
%91 = icmp ne i32 %90, 1
br i1 %91, label %92, label %96
92: ; preds = %88
%93 = load i32, i32* %7
%94 = icmp ne i32 %93, 2
br i1 %94, label %95, label %96
95: ; preds = %92
store i32 1, i32* %7
br label %96
96: ; preds = %95, %92, %88
%97 = call i32 @getConfigInt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 1)
store i32 %97, i32* %8
%98 = load i32, i32* %8
%99 = icmp slt i32 %98, 1
br i1 %99, label %100, label %101
100: ; preds = %96
store i32 10, i32* %8
br label %101
101: ; preds = %100, %96
%102 = load i32, i32* %8
%103 = zext i32 %102 to i64
%104 = alloca i8*, i64 %103
store i64 %103, i64* %9
%105 = load i32, i32* %7
%106 = icmp eq i32 %105, 2
br i1 %106, label %107, label %110
107: ; preds = %101
%108 = load i32, i32* %8
%109 = call i32 @getHourlyItems(i8** %104, i32 %108, i8* %79)
br label %113
110: ; preds = %101
%111 = load i32, i32* %8
%112 = call i32 @getDailyItems(i8** %104, i32 %111, i8* %79)
br label %113
113: ; preds = %110, %107
store i32 0, i32* %11
store i32 0, i32* %10
br label %114
114: ; preds = %128, %113
%115 = load i32, i32* %10
%116 = load i32, i32* %8
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %131
118: ; preds = %114
%119 = load i32, i32* %10
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8*, i8** %104, i64 %120
%122 = load i8*, i8** %121
%123 = call i64 @strlen(i8* %122)
%124 = load i32, i32* %11
%125 = sext i32 %124 to i64
%126 = add nsw i64 %125, %123
%127 = trunc i64 %126 to i32
store i32 %127, i32* %11
br label %128
128: ; preds = %118
%129 = load i32, i32* %10
%130 = add nsw i32 %129, 1
store i32 %130, i32* %10
br label %114
131: ; preds = %114
%132 = load i32, i32* %11
%133 = add nsw i32 %132, 1
%134 = call i8* @malloc(i32 %133)
store i8* %134, i8** %12
store i32 0, i32* %14
store i32 0, i32* %13
br label %135
135: ; preds = %158, %131
%136 = load i32, i32* %13
%137 = load i32, i32* %8
%138 = icmp slt i32 %136, %137
br i1 %138, label %139, label %161
139: ; preds = %135
%140 = load i32, i32* %13
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8*, i8** %104, i64 %141
%143 = load i8*, i8** %142
store i8* %143, i8** %15
%144 = load i8*, i8** %12
%145 = load i32, i32* %14
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i8, i8* %144, i64 %146
%148 = load i8*, i8** %15
%149 = call i32 @strcpy(i8* %147, i8* %148)
%150 = load i8*, i8** %15
%151 = call i64 @strlen(i8* %150)
%152 = load i32, i32* %14
%153 = sext i32 %152 to i64
%154 = add nsw i64 %153, %151
%155 = trunc i64 %154 to i32
store i32 %155, i32* %14
%156 = load i8*, i8** %15
%157 = call i32 @free(i8* %156)
br label %158
158: ; preds = %139
%159 = load i32, i32* %13
%160 = add nsw i32 %159, 1
store i32 %160, i32* %13
br label %135
161: ; preds = %135
%162 = load i8*, i8** %12
%163 = load i32, i32* %11
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8, i8* %162, i64 %164
store i8 0, i8* %165
%166 = load i32, i32* %7
%167 = call i8* @getPubDate(i32 %166)
store i8* %167, i8** %16
%168 = load i32, i32* %7
%169 = icmp eq i32 %168, 2
%170 = zext i1 %169 to i64
%171 = select i1 %169, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0)
store i8* %171, i8** %17
%172 = load i32, i32* %7
%173 = icmp eq i32 %172, 2
%174 = zext i1 %173 to i64
%175 = select i1 %173, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0)
store i8* %175, i8** %18
%176 = load i8*, i8** %2
%177 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i8* %176)
store %struct.NameValuePair* %177, %struct.NameValuePair** %19
%178 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* %79)
%179 = call i32 @appendNameValuePair(%struct.NameValuePair** %19, %struct.NameValuePair* %178)
%180 = load i8*, i8** %16
%181 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* %180)
%182 = call i32 @appendNameValuePair(%struct.NameValuePair** %19, %struct.NameValuePair* %181)
%183 = load i8*, i8** %12
%184 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* %183)
%185 = call i32 @appendNameValuePair(%struct.NameValuePair** %19, %struct.NameValuePair* %184)
%186 = load i8*, i8** %17
%187 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %186)
%188 = call i32 @appendNameValuePair(%struct.NameValuePair** %19, %struct.NameValuePair* %187)
%189 = load i8*, i8** %18
%190 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %189)
%191 = call i32 @appendNameValuePair(%struct.NameValuePair** %19, %struct.NameValuePair* %190)
%192 = load i8*, i8** %2
%193 = call i32 @free(i8* %192)
%194 = load i8*, i8** %16
%195 = call i32 @free(i8* %194)
%196 = load i8*, i8** %12
%197 = call i32 @free(i8* %196)
%198 = load %struct.NameValuePair*, %struct.NameValuePair** %19
%199 = load i8*, i8** %5
ret %struct.NameValuePair* %198
}

LLVM IR (-O2):
%struct.NameValuePair = type { i32 }
@.str = [16 x i8] c"web.server_name\00"
@.str.1 = [19 x i8] c"BitMeter OS Events\00"
@.str.2 = [8 x i8] c"%s - %s\00"
@.str.3 = [13 x i8] c"web.rss.host\00"
@.str.4 = [10 x i8] c"localhost\00"
@.str.5 = [9 x i8] c"web.port\00"
@.str.6 = [13 x i8] c"http://%s:%d\00"
@.str.7 = [13 x i8] c"web.rss.freq\00"
@.str.8 = [14 x i8] c"web.rss.items\00"
@.str.9 = [3 x i8] c"60\00"
@.str.10 = [5 x i8] c"1440\00"
@.str.11 = [7 x i8] c"hourly\00"
@.str.12 = [6 x i8] c"daily\00"
@.str.13 = [6 x i8] c"title\00"
@.str.14 = [5 x i8] c"link\00"
@.str.15 = [8 x i8] c"pubdate\00"
@.str.16 = [6 x i8] c"items\00"
@.str.17 = [4 x i8] c"ttl\00"
@.str.18 = [5 x i8] c"freq\00"
define %struct.NameValuePair* @makeRssRequestValues() {
%1 = alloca %struct.NameValuePair*
%2 = tail call i8* @getConfigText(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call dereferenceable_or_null(19) i8* @strdup(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %19
6: ; preds = %0
%7 = tail call i64 @strlen(i8* %2)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = trunc i64 %7 to i32
%11 = add i32 %10, 22
%12 = tail call i8* @malloc(i32 %11)
%13 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %16
14: ; preds = %6
%15 = tail call dereferenceable_or_null(19) i8* @strdup(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %9
%17 = phi i8* [ %12, %9 ], [ %15, %14 ]
%18 = tail call i32 @free(i8* %2)
br label %19
19: ; preds = %4, %16
%20 = phi i8* [ %17, %16 ], [ %5, %4 ]
%21 = tail call i8* @getConfigText(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 1)
%22 = icmp eq i8* %21, null
br i1 %22, label %28, label %23
23: ; preds = %19
%24 = load i8, i8* %21
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = tail call i32 @free(i8* %21)
br label %28
28: ; preds = %19, %26
%29 = tail call dereferenceable_or_null(10) i8* @strdup(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %23
%31 = phi i8* [ %29, %28 ], [ %21, %23 ]
%32 = tail call i32 @getConfigInt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 1)
%33 = add i32 %32, -65536
%34 = icmp ult i32 %33, -65535
%35 = select i1 %34, i32 2605, i32 %32
%36 = tail call i64 @strlen(i8* dereferenceable(1) %31)
%37 = add nsw i64 %36, 14
%38 = alloca i8, i64 %37
%39 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %38, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %31, i32 %35)
%40 = icmp eq i8* %31, null
br i1 %40, label %43, label %41
41: ; preds = %30
%42 = tail call i32 @free(i8* %31)
br label %43
43: ; preds = %41, %30
%44 = tail call i32 @getConfigInt(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 1)
%45 = add i32 %44, -3
%46 = icmp ult i32 %45, -2
%47 = select i1 %46, i32 1, i32 %44
%48 = tail call i32 @getConfigInt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 1)
%49 = icmp slt i32 %48, 1
%50 = select i1 %49, i32 10, i32 %48
%51 = zext i32 %50 to i64
%52 = alloca i8*, i64 %51
%53 = icmp eq i32 %47, 2
br i1 %53, label %54, label %56
54: ; preds = %43
%55 = call i32 @getHourlyItems(i8** %52, i32 %50, i8* %38)
br label %58
56: ; preds = %43
%57 = call i32 @getDailyItems(i8** %52, i32 %50, i8* %38)
br label %58
58: ; preds = %54, %56
br label %59
59: ; preds = %58, %59
%60 = phi i64 [ %67, %59 ], [ 0, %58 ]
%61 = phi i32 [ %66, %59 ], [ 0, %58 ]
%62 = getelementptr inbounds i8*, i8** %52, i64 %60
%63 = load i8*, i8** %62
%64 = call i64 @strlen(i8* dereferenceable(1) %63)
%65 = trunc i64 %64 to i32
%66 = add i32 %61, %65
%67 = add nuw nsw i64 %60, 1
%68 = icmp eq i64 %67, %51
br i1 %68, label %69, label %59
69: ; preds = %59
%70 = add nsw i32 %66, 1
%71 = call i8* @malloc(i32 %70)
br label %72
72: ; preds = %69, %72
%73 = phi i64 [ 0, %69 ], [ %84, %72 ]
%74 = phi i64 [ 0, %69 ], [ %82, %72 ]
%75 = getelementptr inbounds i8*, i8** %52, i64 %73
%76 = load i8*, i8** %75
%77 = shl i64 %74, 32
%78 = ashr exact i64 %77, 32
%79 = getelementptr inbounds i8, i8* %71, i64 %78
%80 = call i32 @strcpy(i8* %79, i8* %76)
%81 = call i64 @strlen(i8* dereferenceable(1) %76)
%82 = add nsw i64 %81, %78
%83 = call i32 @free(i8* %76)
%84 = add nuw nsw i64 %73, 1
%85 = icmp eq i64 %84, %51
br i1 %85, label %86, label %72
86: ; preds = %72
%87 = sext i32 %66 to i64
%88 = getelementptr inbounds i8, i8* %71, i64 %87
store i8 0, i8* %88
%89 = call i8* @getPubDate(i32 %47)
%90 = select i1 %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0)
%91 = select i1 %53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0)
%92 = bitcast %struct.NameValuePair** %1 to i8*
%93 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i8* %20)
store %struct.NameValuePair* %93, %struct.NameValuePair** %1
%94 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* %38)
%95 = call i32 @appendNameValuePair(%struct.NameValuePair** %1, %struct.NameValuePair* %94)
%96 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* %89)
%97 = call i32 @appendNameValuePair(%struct.NameValuePair** %1, %struct.NameValuePair* %96)
%98 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* %71)
%99 = call i32 @appendNameValuePair(%struct.NameValuePair** %1, %struct.NameValuePair* %98)
%100 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %90)
%101 = call i32 @appendNameValuePair(%struct.NameValuePair** %1, %struct.NameValuePair* %100)
%102 = call %struct.NameValuePair* @makeNameValuePair(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %91)
%103 = call i32 @appendNameValuePair(%struct.NameValuePair** %1, %struct.NameValuePair* %102)
%104 = call i32 @free(i8* %20)
%105 = call i32 @free(i8* %89)
%106 = call i32 @free(i8* %71)
%107 = load %struct.NameValuePair*, %struct.NameValuePair** %1
ret %struct.NameValuePair* %107
}