#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*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ build_post_bin(int /*<<< orphan*/ **, size_t *,
                                  int /*<<< orphan*/ *, scalar_t__);
scalar_t__ strlen(char *);
void build_post(uint8_t **post, size_t *post_len, char *newchar,
                size_t *content_len) {
  build_post_bin(post, post_len, (uint8_t *)newchar, strlen(newchar));
  if (content_len) {
    *content_len += strlen(newchar);
  }
}


x86 assembly (clang, -O0):
<build_post>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %rax,%rcx
call   1040 <build_post_bin@plt>
cmpq   $0x0,-0x20(%rbp)
je     118e <build_post+0x6e>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_post>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1040 <build_post_bin@plt>
test   %r14,%r14
je     115d <build_post+0x3d>
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @build_post(i32** %0, i64* %1, i8* %2, i64* %3) {
%5 = alloca i32**
%6 = alloca i64*
%7 = alloca i8*
%8 = alloca i64*
store i32** %0, i32*** %5
store i64* %1, i64** %6
store i8* %2, i8** %7
store i64* %3, i64** %8
%9 = load i32**, i32*** %5
%10 = load i64*, i64** %6
%11 = load i8*, i8** %7
%12 = bitcast i8* %11 to i32*
%13 = load i8*, i8** %7
%14 = call i64 @strlen(i8* %13)
%15 = call i32 @build_post_bin(i32** %9, i64* %10, i32* %12, i64 %14)
%16 = load i64*, i64** %8
%17 = icmp ne i64* %16, null
br i1 %17, label %18, label %24
18: ; preds = %4
%19 = load i8*, i8** %7
%20 = call i64 @strlen(i8* %19)
%21 = load i64*, i64** %8
%22 = load i64, i64* %21
%23 = add i64 %22, %20
store i64 %23, i64* %21
br label %24
24: ; preds = %18, %4
ret void
}

LLVM IR (-O2):
define void @build_post(i32** %0, i64* %1, i8* %2, i64* %3) {
%5 = bitcast i8* %2 to i32*
%6 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%7 = tail call i32 @build_post_bin(i32** %0, i64* %1, i32* %5, i64 %6)
%8 = icmp eq i64* %3, null
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%11 = load i64, i64* %3
%12 = add i64 %11, %10
store i64 %12, i64* %3
br label %13
13: ; preds = %9, %4
ret void
}