#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 */
typedef int /*<<< orphan*/ body_str;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ strncat(char *, char *, size_t);
void http_response_appd_body(char *body, char *output, size_t *len) {
  if (body == NULL || body[0] == '\0')
    return;
  strncat(output, "\r\n", 2);
  char body_str[((1024 * 256) - ((31 + 1) * 256))];
  memset(body_str, '\0', sizeof(body_str));
  memcpy(body_str, body, sizeof(body_str) - 1);
  strncat(output, body_str, *len);
}


x86 assembly (clang, -O0):
<http_response_appd_body>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3e020,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1162 <http_response_appd_body+0x32>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1167 <http_response_appd_body+0x37>
jmp    11bb <http_response_appd_body+0x8b>
mov    -0x10(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncat@plt>
lea    -0x3e020(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e000,%edx
call   1030 <memset@plt>
lea    -0x3e020(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x3dfff,%edx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rdi
lea    -0x3e020(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
call   1040 <strncat@plt>
add    $0x3e020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_response_appd_body>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x3e008,%rsp
test   %rdi,%rdi
je     1195 <http_response_appd_body+0x65>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1195 <http_response_appd_body+0x65>
mov    %rdx,%r14
mov    %rsi,%r15
lea    0xea8(%rip),%rsi
mov    $0x2,%edx
mov    %r15,%rdi
call   1040 <strncat@plt>
mov    %rsp,%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x3e000,%edx
call   1030 <memset@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x3dfff,%edx
call   1050 <memcpy@plt>
mov    (%r14),%rdx
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <strncat@plt>
add    $0x3e008,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
define void @http_response_appd_body(i8* %0, i8* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca [253952 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64* %2, i64** %6
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %10, %3
br label %30
17: ; preds = %10
%18 = load i8*, i8** %5
%19 = call i32 @strncat(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2)
%20 = getelementptr inbounds [253952 x i8], [253952 x i8]* %7, i64 0, i64 0
%21 = call i32 @memset(i8* %20, i8 signext 0, i32 253952)
%22 = getelementptr inbounds [253952 x i8], [253952 x i8]* %7, i64 0, i64 0
%23 = load i8*, i8** %4
%24 = call i32 @memcpy(i8* %22, i8* %23, i32 253951)
%25 = load i8*, i8** %5
%26 = getelementptr inbounds [253952 x i8], [253952 x i8]* %7, i64 0, i64 0
%27 = load i64*, i64** %6
%28 = load i64, i64* %27
%29 = call i32 @strncat(i8* %25, i8* %26, i64 %28)
br label %30
30: ; preds = %17, %16
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
define void @http_response_appd_body(i8* %0, i8* %1, i64* nocapture %2) {
%4 = alloca [253952 x i8]
%5 = icmp eq i8* %0, null
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call i32 @strncat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2)
%11 = getelementptr inbounds [253952 x i8], [253952 x i8]* %4, i64 0, i64 0
%12 = call i32 @memset(i8* %11, i8 signext 0, i32 253952)
%13 = call i32 @memcpy(i8* %11, i8* %0, i32 253951)
%14 = load i64, i64* %2
%15 = call i32 @strncat(i8* %1, i8* %11, i64 %14)
br label %16
16: ; preds = %3, %6, %9
ret void
}