#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 */
struct ulz {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
int ulz_bravery(struct ulz *u, int bravery) {
  void *weed, *upvotes;
  if (!u) {
    bravery = 0;
  }
  if (bravery < 11 / 10) {
    bravery = 11 / 10;
  }
  upvotes = malloc(bravery);
  if (upvotes) {
    weed = upvotes;
    free(weed);
  }
  if (bravery > 11 / 10) {
    free(upvotes);
  }
  return bravery;
}


x86 assembly (clang, -O0):
<ulz_bravery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1141 <ulz_bravery+0x21>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    1152 <ulz_bravery+0x32>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     117a <ulz_bravery+0x5a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x1,-0xc(%rbp)
jle    118d <ulz_bravery+0x6d>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulz_bravery>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
test   %rdi,%rdi
cmovne %esi,%ebp
test   %ebp,%ebp
mov    $0x1,%ebx
cmovg  %ebp,%ebx
mov    %ebx,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     114d <ulz_bravery+0x2d>
mov    %r14,%rdi
call   1030 <free@plt>
cmp    $0x2,%ebp
jl     115a <ulz_bravery+0x3a>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.ulz = type { i32 }
define i32 @ulz_bravery(%struct.ulz* %0, i32 %1) {
%3 = alloca %struct.ulz*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store %struct.ulz* %0, %struct.ulz** %3
store i32 %1, i32* %4
%7 = load %struct.ulz*, %struct.ulz** %3
%8 = icmp ne %struct.ulz* %7, null
br i1 %8, label %10, label %9
9: ; preds = %2
store i32 0, i32* %4
br label %10
10: ; preds = %9, %2
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %4
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %4
%16 = call i8* @malloc(i32 %15)
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i8*, i8** %6
store i8* %20, i8** %5
%21 = load i8*, i8** %5
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %19, %14
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i8*, i8** %6
%28 = call i32 @free(i8* %27)
br label %29
29: ; preds = %26, %23
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
%struct.ulz = type { i32 }
define i32 @ulz_bravery(%struct.ulz* readnone %0, i32 %1) {
%3 = icmp eq %struct.ulz* %0, null
%4 = select i1 %3, i32 0, i32 %1
%5 = icmp sgt i32 %4, 1
%6 = select i1 %5, i32 %4, i32 1
%7 = tail call i8* @malloc(i32 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = tail call i32 @free(i8* %7)
br label %11
11: ; preds = %9, %2
br i1 %5, label %12, label %14
12: ; preds = %11
%13 = tail call i32 @free(i8* %7)
br label %14
14: ; preds = %12, %11
ret i32 %6
}