#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*/ new_directive(int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int, ...);
int /*<<< orphan*/ strdup(char *);
void def_heapsize(int reserve, int commit) {
  char b[200];
  if (commit > 0)
    sprintf(b, "-heap 0x%x,0x%x ", reserve, commit);
  else
    sprintf(b, "-heap 0x%x ", reserve);
  new_directive(strdup(b));
}


x86 assembly (clang, -O0):
<def_heapsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    116b <def_heapsize+0x3b>
lea    -0xd0(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1183 <def_heapsize+0x53>
lea    -0xd0(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe95(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0xd0(%rbp),%rdi
call   1050 <strdup@plt>
mov    %eax,%edi
call   1030 <new_directive@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<def_heapsize>:
sub    $0xc8,%rsp
mov    %edi,%edx
test   %esi,%esi
jle    1152 <def_heapsize+0x22>
mov    %esi,%ecx
lea    0xeba(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1163 <def_heapsize+0x33>
lea    0xeb8(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rsp,%rdi
call   1050 <strdup@plt>
mov    %eax,%edi
call   1030 <new_directive@plt>
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"-heap 0x%x,0x%x \00"
@.str.1 = [12 x i8] c"-heap 0x%x \00"
define void @def_heapsize(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [200 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
br label %17
13: ; preds = %2
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%15 = load i32, i32* %3
%16 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %13, %8
%18 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%19 = call i32 @strdup(i8* %18)
%20 = call i32 @new_directive(i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"-heap 0x%x,0x%x \00"
@.str.1 = [12 x i8] c"-heap 0x%x \00"
define void @def_heapsize(i32 %0, i32 %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %10
8: ; preds = %2
%9 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %10
10: ; preds = %8, %6
%11 = call i32 @strdup(i8* %4)
%12 = call i32 @new_directive(i32 %11)
ret void
}