#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*/ release_memory_block(void *);
int /*<<< orphan*/ release_processor();
void *request_memory_block();
int /*<<< orphan*/ rtx_dbug_outs(char *);
int /*<<< orphan*/ rtx_dbug_outs_int(char *, int);
void mem_test4() {
  rtx_dbug_outs("Starting Memory Test 4\r\n");
  rtx_dbug_outs("Requesting one block\r\n");
  void *oneBlock = request_memory_block();
  rtx_dbug_outs_int("Block recieved. Block address: \r\n", (int)oneBlock);
  rtx_dbug_outs("Releasing proccessor in Memory Test 4\r\n");
  release_processor();
  rtx_dbug_outs("Restarting Memory Test 4\r\n");
  release_memory_block(oneBlock);
  rtx_dbug_outs("Memory Block Got Released\r\n");
  rtx_dbug_outs("Finished Memory Test 4\r\n");
}


x86 assembly (clang, -O0):
<mem_test4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
lea    0xeae(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
mov    $0x0,%al
call   1050 <request_memory_block@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xea8(%rip),%rdi
call   1070 <rtx_dbug_outs_int@plt>
lea    0xebe(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
mov    $0x0,%al
call   1030 <release_processor@plt>
lea    0xed3(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
mov    -0x8(%rbp),%rdi
call   1060 <release_memory_block@plt>
lea    0xed9(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
lea    0xee9(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_test4>:
push   %rbx
lea    0xea8(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
lea    0xeb5(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
xor    %eax,%eax
call   1050 <request_memory_block@plt>
mov    %rax,%rbx
lea    0xeb6(%rip),%rdi
mov    %ebx,%esi
call   1070 <rtx_dbug_outs_int@plt>
lea    0xeca(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
xor    %eax,%eax
call   1030 <release_processor@plt>
lea    0xedf(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
mov    %rbx,%rdi
call   1060 <release_memory_block@plt>
lea    0xee6(%rip),%rdi
call   1040 <rtx_dbug_outs@plt>
lea    0xef6(%rip),%rdi
pop    %rbx
jmp    1040 <rtx_dbug_outs@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Starting Memory Test 4\0D\0A\00"
@.str.1 = [23 x i8] c"Requesting one block\0D\0A\00"
@.str.2 = [34 x i8] c"Block recieved. Block address: \0D\0A\00"
@.str.3 = [40 x i8] c"Releasing proccessor in Memory Test 4\0D\0A\00"
@.str.4 = [27 x i8] c"Restarting Memory Test 4\0D\0A\00"
@.str.5 = [28 x i8] c"Memory Block Got Released\0D\0A\00"
@.str.6 = [25 x i8] c"Finished Memory Test 4\0D\0A\00"
define void @mem_test4() {
%1 = alloca i8*
%2 = call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%4 = call i8* (...) @request_memory_block()
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = ptrtoint i8* %5 to i32
%7 = call i32 @rtx_dbug_outs_int(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (...) @release_processor()
%10 = call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%11 = load i8*, i8** %1
%12 = call i32 @release_memory_block(i8* %11)
%13 = call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Starting Memory Test 4\0D\0A\00"
@.str.1 = [23 x i8] c"Requesting one block\0D\0A\00"
@.str.2 = [34 x i8] c"Block recieved. Block address: \0D\0A\00"
@.str.3 = [40 x i8] c"Releasing proccessor in Memory Test 4\0D\0A\00"
@.str.4 = [27 x i8] c"Restarting Memory Test 4\0D\0A\00"
@.str.5 = [28 x i8] c"Memory Block Got Released\0D\0A\00"
@.str.6 = [25 x i8] c"Finished Memory Test 4\0D\0A\00"
define void @mem_test4() {
%1 = tail call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i8* (...) @request_memory_block()
%4 = ptrtoint i8* %3 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @rtx_dbug_outs_int(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 (...) @release_processor()
%9 = tail call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @release_memory_block(i8* %3)
%11 = tail call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%12 = tail call i32 @rtx_dbug_outs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
ret void
}