#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*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *write_cvitem(char *header, char *contents) {
  char *open = "<p><strong>";
  char *closeHeader = "</strong><br>\n";
  char *out = malloc(strlen(open) + strlen(header) + strlen(closeHeader) +
                     strlen(contents) + 1);
  strcpy(out, open);
  strcat(out, header);
  strcat(out, closeHeader);
  strcat(out, contents);
  free(header);
  free(contents);
  return out;
}


x86 assembly (clang, -O0):
<write_cvitem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe99(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x30(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_cvitem>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1050 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0x1a,%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe7e(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
lea    0xe70(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"<p><strong>\00"
@.str.1 = [15 x i8] c"</strong><br>\0A\00"
define i8* @write_cvitem(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %6
%8 = load i8*, i8** %5
%9 = call i64 @strlen(i8* %8)
%10 = load i8*, i8** %3
%11 = call i64 @strlen(i8* %10)
%12 = add nsw i64 %9, %11
%13 = load i8*, i8** %6
%14 = call i64 @strlen(i8* %13)
%15 = add nsw i64 %12, %14
%16 = load i8*, i8** %4
%17 = call i64 @strlen(i8* %16)
%18 = add nsw i64 %15, %17
%19 = add nsw i64 %18, 1
%20 = call i8* @malloc(i64 %19)
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = load i8*, i8** %5
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = load i8*, i8** %7
%25 = load i8*, i8** %3
%26 = call i32 @strcat(i8* %24, i8* %25)
%27 = load i8*, i8** %7
%28 = load i8*, i8** %6
%29 = call i32 @strcat(i8* %27, i8* %28)
%30 = load i8*, i8** %7
%31 = load i8*, i8** %4
%32 = call i32 @strcat(i8* %30, i8* %31)
%33 = load i8*, i8** %3
%34 = call i32 @free(i8* %33)
%35 = load i8*, i8** %4
%36 = call i32 @free(i8* %35)
%37 = load i8*, i8** %7
ret i8* %37
}

LLVM IR (-O2):
@.str = [12 x i8] c"<p><strong>\00"
@.str.1 = [15 x i8] c"</strong><br>\0A\00"
define i8* @write_cvitem(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 26
%6 = add i64 %5, %4
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @strcat(i8* %7, i8* %0)
%10 = tail call i32 @strcat(i8* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @strcat(i8* %7, i8* %1)
%12 = tail call i32 @free(i8* %0)
%13 = tail call i32 @free(i8* %1)
ret i8* %7
}