#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 *);
int /*<<< orphan*/ printf(char *, ...);
char *render_element(char *);
int /*<<< orphan*/ render_init();
int main(int arc, char *argv[]) {
  char *buf;
  render_init();
  buf = render_element("A");
  printf("Successfully rendered buffer: %s\n", buf);
  free(buf);
  buf = render_element("UnknownElement");
  if (buf) {
    printf("Successfully failed to render buffer\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <render_init@plt>
lea    0xe9c(%rip),%rdi
call   1050 <render_element@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    0xe95(%rip),%rdi
call   1050 <render_element@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11b1 <main+0x71>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1070 <render_init@plt>
lea    0xea1(%rip),%rdi
call   1060 <render_element@plt>
mov    %rax,%rbx
lea    0xe94(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe9d(%rip),%rdi
call   1060 <render_element@plt>
test   %rax,%rax
je     119d <main+0x4d>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"A\00"
@.str.1 = [34 x i8] c"Successfully rendered buffer: %s\0A\00"
@.str.2 = [15 x i8] c"UnknownElement\00"
@.str.3 = [38 x i8] c"Successfully failed to render buffer\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @render_init()
%8 = call i8* @render_element(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %6
%12 = call i32 @free(i8* %11)
%13 = call i8* @render_element(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i8* %13, i8** %6
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"A\00"
@.str.1 = [34 x i8] c"Successfully rendered buffer: %s\0A\00"
@.str.2 = [15 x i8] c"UnknownElement\00"
@str = [37 x i8] c"Successfully failed to render buffer\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @render_init()
%4 = tail call i8* @render_element(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = tail call i32 @free(i8* %4)
%7 = tail call i8* @render_element(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
ret i32 0
}