#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*/ strcat(char *, char const *);
void append_content(char *buf, const char *x, int len, int mlen) {
  int i;
  int d;
  char *p;
  strcat(buf, x);
  d = mlen - len;
  p = buf;
  while (*p)
    p++;
  for (i = 0; i < d; i++) {
    *p++ = ' ';
  }
  *p = 0;
}


x86 assembly (clang, -O0):
<append_content>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcat@plt>
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     1162 <append_content+0x52>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1144 <append_content+0x34>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1195 <append_content+0x85>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x20,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1169 <append_content+0x59>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_content>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %rdi,%rbx
call   1040 <strcat@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1140 <append_content+0x20>
lea    -0x1(%rbx),%rdi
cmp    %r14d,%ebp
jle    116c <append_content+0x4c>
not    %r14d
add    %ebp,%r14d
lea    0x1(%r14),%rdx
mov    $0x20,%esi
call   1030 <memset@plt>
add    %r14,%rbx
mov    %rbx,%rdi
movb   $0x0,(%rdi)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @append_content(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i32 @strcat(i8* %12, i8* %13)
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = sub nsw i32 %15, %16
store i32 %17, i32* %10
%18 = load i8*, i8** %5
store i8* %18, i8** %11
br label %19
19: ; preds = %23, %4
%20 = load i8*, i8** %11
%21 = load i8, i8* %20
%22 = icmp ne i8 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i8*, i8** %11
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %11
br label %19
26: ; preds = %19
store i32 0, i32* %9
br label %27
27: ; preds = %34, %26
%28 = load i32, i32* %9
%29 = load i32, i32* %10
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %37
31: ; preds = %27
%32 = load i8*, i8** %11
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %11
store i8 32, i8* %32
br label %34
34: ; preds = %31
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %27
37: ; preds = %27
%38 = load i8*, i8** %11
store i8 0, i8* %38
ret void
}

LLVM IR (-O2):
define void @append_content(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @strcat(i8* %0, i8* %1)
br label %6
6: ; preds = %6, %4
%7 = phi i8* [ %0, %4 ], [ %10, %6 ]
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
%10 = getelementptr inbounds i8, i8* %7, i64 1
br i1 %9, label %11, label %6
11: ; preds = %6
%12 = icmp sgt i32 %3, %2
br i1 %12, label %13, label %19
13: ; preds = %11
%14 = xor i32 %2, -1
%15 = add i32 %14, %3
%16 = zext i32 %15 to i64
%17 = add nuw nsw i64 %16, 1
%18 = getelementptr i8, i8* %7, i64 %17
br label %19
19: ; preds = %13, %11
%20 = phi i8* [ %7, %11 ], [ %18, %13 ]
store i8 0, i8* %20
ret void
}