#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  void *myblock = NULL;
  int count = 0;
  myblock = (void *)malloc(1024 * 1024 * 1000);
  if (!myblock) {
    printf("ERROR allocating %d\n", 1024 * 1024 * 1000);
  }
  printf("Currently allocating %d\n", 1024 * 1024 * 1000);
  free(myblock);
  exit(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)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x3e800000,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118f <main+0x4f>
lea    0xe7b(%rip),%rdi
mov    $0x3e800000,%esi
call   1040 <printf@plt>
lea    0xe7f(%rip),%rdi
mov    $0x3e800000,%esi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3e800000,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1164 <main+0x24>
lea    0xea6(%rip),%rdi
mov    $0x3e800000,%esi
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x3e800000,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"ERROR allocating %d\0A\00"
@.str.1 = [25 x i8] c"Currently allocating %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %7
%8 = call i64 @malloc(i32 1048576000)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 1048576000)
br label %14
14: ; preds = %12, %2
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 1048576000)
%16 = load i8*, i8** %6
%17 = call i32 @free(i8* %16)
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [21 x i8] c"ERROR allocating %d\0A\00"
@.str.1 = [25 x i8] c"Currently allocating %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 1048576000)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 1048576000)
br label %7
7: ; preds = %5, %2
%8 = inttoptr i64 %3 to i8*
%9 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 1048576000)
%10 = tail call i32 @free(i8* %8)
%11 = tail call i32 @exit(i32 0)
unreachable
}