#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*/ check_byte_arrays(unsigned char *, unsigned int,
                                     unsigned char *, unsigned int, char *);
int /*<<< orphan*/ output_os_return(unsigned char *, int, unsigned int *);
unsigned char *raw_linux_return();
unsigned int raw_linux_return_size();
void test_output_footer() {
  unsigned char *expected;
  unsigned int expected_len;
  unsigned char actual[128];
  unsigned int actual_len = 0;
  expected = raw_linux_return();
  expected_len = raw_linux_return_size();
  output_os_return(actual, 128, &actual_len);
  check_byte_arrays(actual, actual_len, expected, expected_len, "SYS_EXIT");
}


x86 assembly (clang, -O0):
<test_output_footer>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x94(%rbp)
mov    $0x0,%al
call   1040 <raw_linux_return@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <raw_linux_return_size@plt>
mov    %eax,-0xc(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0x80,%esi
lea    -0x94(%rbp),%rdx
call   1030 <output_os_return@plt>
lea    -0x90(%rbp),%rdi
mov    -0x94(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xe63(%rip),%r8
call   1050 <check_byte_arrays@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_output_footer>:
push   %rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
call   1040 <raw_linux_return@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <raw_linux_return_size@plt>
mov    %eax,%ebp
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
mov    $0x80,%esi
call   1030 <output_os_return@plt>
mov    0xc(%rsp),%esi
lea    0xe78(%rip),%r8
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %ebp,%ecx
call   1050 <check_byte_arrays@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"SYS_EXIT\00"
define void @test_output_footer() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca i32
store i32 0, i32* %4
%5 = call i8* (...) @raw_linux_return()
store i8* %5, i8** %1
%6 = call i32 (...) @raw_linux_return_size()
store i32 %6, i32* %2
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = call i32 @output_os_return(i8* %7, i32 128, i32* %4)
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* %4
%11 = load i8*, i8** %1
%12 = load i32, i32* %2
%13 = call i32 @check_byte_arrays(i8* %9, i32 %10, i8* %11, i32 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"SYS_EXIT\00"
define void @test_output_footer() {
%1 = alloca [128 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i8* (...) @raw_linux_return()
%6 = tail call i32 (...) @raw_linux_return_size()
%7 = call i32 @output_os_return(i8* %3, i32 128, i32* %2)
%8 = load i32, i32* %2
%9 = call i32 @check_byte_arrays(i8* %3, i32 %8, i8* %5, i32 %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}