#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 tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ getRfc822Time(struct tm *, char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char *, char *);
scalar_t__ strlen(char *);
char *makeItem(char *title, char *amountDescription, char *alertDescription,
               struct tm *pubTime, char *guid) {
  char pubTimeTxt[48];
  getRfc822Time(pubTime, pubTimeTxt);
  if (alertDescription == NULL) {
    alertDescription = "";
  }
  char *itemTxt =
      malloc(6 + 7 + strlen(title) + 8 + 13 + strlen(amountDescription) +
             strlen("&lt;br&gt;") + strlen(alertDescription) + 14 + 9 +
             strlen(pubTimeTxt) + 10 + 27 + strlen(guid) + 7 + 7 + 1);
  sprintf(itemTxt,
          "<item>"
          "<title>%s</title>"
          "<description>%s%s%s</description>"
          "<pubDate>%s</pubDate>"
          "<guid isPermaLink=\"false\">%s</guid>"
          "</item>",
          title, amountDescription,
          strlen(alertDescription) > 0 ? "&lt;br&gt;" : "", alertDescription,
          pubTimeTxt, guid);
  return itemTxt;
}


x86 assembly (clang, -O0):
<makeItem>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <getRfc822Time@plt>
cmpq   $0x0,-0x18(%rbp)
jne    1182 <makeItem+0x42>
lea    0xe8c(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0xd,%rax
add    $0x8,%rax
add    $0xd,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0xa8(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xa0(%rbp)
lea    0xe3e(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0xa0(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x98(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x98(%rbp),%rax
add    %rcx,%rax
add    $0xe,%rax
add    $0x9,%rax
mov    %rax,-0x90(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x90(%rbp),%rax
add    %rcx,%rax
add    $0xa,%rax
add    $0x1b,%rax
mov    %rax,-0x88(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x88(%rbp),%rdi
add    %rax,%rdi
add    $0x7,%rdi
add    $0x7,%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%rdx
mov    -0x70(%rbp),%rcx
mov    %rax,%rsi
lea    0xd86(%rip),%r8
lea    0xd75(%rip),%rax
cmp    $0x0,%rsi
cmovg  %rax,%r8
mov    -0x18(%rbp),%r9
lea    -0x60(%rbp),%r10
mov    -0x28(%rbp),%rax
lea    0xd65(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <sprintf@plt>
mov    -0x68(%rbp),%rax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeItem>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8,%r13
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rsi,(%rsp)
mov    %rdi,%rbp
mov    %rdi,0x8(%rsp)
lea    0x10(%rsp),%r12
mov    %rcx,%rdi
mov    %r12,%rsi
call   1060 <getRfc822Time@plt>
test   %rbx,%rbx
lea    0xe8d(%rip),%rax
cmove  %rax,%rbx
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %rax,%r12
mov    %r13,%rdi
call   1030 <strlen@plt>
add    %rbp,%r15
add    %r14,%r15
add    %r12,%r15
lea    (%rax,%r15,1),%rdi
add    $0x77,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %r14,%r14
lea    0xe28(%rip),%r8
lea    0xe2b(%rip),%rax
cmovle %rax,%r8
lea    0xe21(%rip),%rsi
mov    %rbp,%rdi
mov    0x8(%rsp),%rdx
mov    (%rsp),%rcx
mov    %rbx,%r9
push   %r13
lea    0x18(%rsp),%rax
push   %rax
call   1050 <sprintf@plt>
add    $0x10,%rsp
mov    %rbp,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [1 x i8] zeroinitializer
@.str.1 = [11 x i8] c"&lt;br&gt;\00"
@.str.2 = [120 x i8] c"<item><title>%s</title><description>%s%s%s</description><pubDate>%s</pubDate><guid isPermaLink=\22false\22>%s</guid></item>\00"
define i8* @makeItem(i8* %0, i8* %1, i8* %2, %struct.tm* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.tm*
%10 = alloca i8*
%11 = alloca [48 x i8]
%12 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store %struct.tm* %3, %struct.tm** %9
store i8* %4, i8** %10
%13 = load %struct.tm*, %struct.tm** %9
%14 = getelementptr inbounds [48 x i8], [48 x i8]* %11, i64 0, i64 0
%15 = call i32 @getRfc822Time(%struct.tm* %13, i8* %14)
%16 = load i8*, i8** %8
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %19
18: ; preds = %5
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %8
br label %19
19: ; preds = %18, %5
%20 = load i8*, i8** %6
%21 = call i64 @strlen(i8* %20)
%22 = add nsw i64 13, %21
%23 = add nsw i64 %22, 8
%24 = add nsw i64 %23, 13
%25 = load i8*, i8** %7
%26 = call i64 @strlen(i8* %25)
%27 = add nsw i64 %24, %26
%28 = call i64 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%29 = add nsw i64 %27, %28
%30 = load i8*, i8** %8
%31 = call i64 @strlen(i8* %30)
%32 = add nsw i64 %29, %31
%33 = add nsw i64 %32, 14
%34 = add nsw i64 %33, 9
%35 = getelementptr inbounds [48 x i8], [48 x i8]* %11, i64 0, i64 0
%36 = call i64 @strlen(i8* %35)
%37 = add nsw i64 %34, %36
%38 = add nsw i64 %37, 10
%39 = add nsw i64 %38, 27
%40 = load i8*, i8** %10
%41 = call i64 @strlen(i8* %40)
%42 = add nsw i64 %39, %41
%43 = add nsw i64 %42, 7
%44 = add nsw i64 %43, 7
%45 = add nsw i64 %44, 1
%46 = call i8* @malloc(i64 %45)
store i8* %46, i8** %12
%47 = load i8*, i8** %12
%48 = load i8*, i8** %6
%49 = load i8*, i8** %7
%50 = load i8*, i8** %8
%51 = call i64 @strlen(i8* %50)
%52 = icmp sgt i64 %51, 0
%53 = zext i1 %52 to i64
%54 = select i1 %52, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%55 = load i8*, i8** %8
%56 = getelementptr inbounds [48 x i8], [48 x i8]* %11, i64 0, i64 0
%57 = load i8*, i8** %10
%58 = call i32 @sprintf(i8* %47, i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str.2, i64 0, i64 0), i8* %48, i8* %49, i8* %54, i8* %55, i8* %56, i8* %57)
%59 = load i8*, i8** %12
ret i8* %59
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [1 x i8] zeroinitializer
@.str.1 = [11 x i8] c"&lt;br&gt;\00"
@.str.2 = [120 x i8] c"<item><title>%s</title><description>%s%s%s</description><pubDate>%s</pubDate><guid isPermaLink=\22false\22>%s</guid></item>\00"
define noalias i8* @makeItem(i8* %0, i8* %1, i8* %2, %struct.tm* %3, i8* %4) {
%6 = alloca [48 x i8]
%7 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 0
%8 = call i32 @getRfc822Time(%struct.tm* %3, i8* %7)
%9 = icmp eq i8* %2, null
%10 = select i1 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
%11 = call i64 @strlen(i8* dereferenceable(1) %0)
%12 = call i64 @strlen(i8* dereferenceable(1) %1)
%13 = call i64 @strlen(i8* dereferenceable(1) %10)
%14 = call i64 @strlen(i8* %7)
%15 = call i64 @strlen(i8* dereferenceable(1) %4)
%16 = add i64 %11, 119
%17 = add i64 %16, %12
%18 = add i64 %17, %13
%19 = add i64 %18, %14
%20 = add i64 %19, %15
%21 = call i8* @malloc(i64 %20)
%22 = icmp sgt i64 %13, 0
%23 = select i1 %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%24 = call i32 @sprintf(i8* dereferenceable(1) %21, i8* dereferenceable(1) getelementptr inbounds ([120 x i8], [120 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1, i8* %23, i8* %10, i8* %7, i8* %4)
ret i8* %21
}