#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(int);
int /*<<< orphan*/ memxor(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ oaep_G(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ printf(char *);
void mixoaep_pad(unsigned char *data, unsigned char *buffer) {
  unsigned char *left = data;
  unsigned char *right = data + (4 * 4096);
  unsigned char *gout = malloc((4 * 4096));
  if (!gout) {
    printf("Cannot allocate needed memory\n");
    exit(EXIT_FAILURE);
  }
  oaep_G(left, gout, buffer);
  memxor(right, gout, (4 * 4096));
  oaep_G(right, gout, buffer);
  memxor(left, gout, (4 * 4096));
  oaep_G(left, gout, buffer);
  memxor(right, gout, (4 * 4096));
  free(gout);
}


x86 assembly (clang, -O0):
<mixoaep_pad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4000,%rax
mov    %rax,-0x20(%rbp)
mov    $0x4000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11b9 <mixoaep_pad+0x59>
lea    0xe5a(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1080 <oaep_G@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x4000,%edx
call   1040 <memxor@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1080 <oaep_G@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x4000,%edx
call   1040 <memxor@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1080 <oaep_G@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x4000,%edx
call   1040 <memxor@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mixoaep_pad>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x4000,%edi
call   1060 <malloc@plt>
test   %rax,%rax
je     11f4 <mixoaep_pad+0x94>
mov    %rax,%rbx
lea    0x4000(%r15),%r12
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1080 <oaep_G@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x4000,%edx
call   1050 <memxor@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1080 <oaep_G@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x4000,%edx
call   1050 <memxor@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1080 <oaep_G@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x4000,%edx
call   1050 <memxor@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>
lea    0xe05(%rip),%rdi
call   1040 <puts@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Cannot allocate needed memory\0A\00"
@EXIT_FAILURE = global i32 0
define void @mixoaep_pad(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
store i8* %8, i8** %5
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 16384
store i8* %10, i8** %6
%11 = call i8* @malloc(i32 16384)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i8*, i8** %5
%20 = load i8*, i8** %7
%21 = load i8*, i8** %4
%22 = call i32 @oaep_G(i8* %19, i8* %20, i8* %21)
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = call i32 @memxor(i8* %23, i8* %24, i32 16384)
%26 = load i8*, i8** %6
%27 = load i8*, i8** %7
%28 = load i8*, i8** %4
%29 = call i32 @oaep_G(i8* %26, i8* %27, i8* %28)
%30 = load i8*, i8** %5
%31 = load i8*, i8** %7
%32 = call i32 @memxor(i8* %30, i8* %31, i32 16384)
%33 = load i8*, i8** %5
%34 = load i8*, i8** %7
%35 = load i8*, i8** %4
%36 = call i32 @oaep_G(i8* %33, i8* %34, i8* %35)
%37 = load i8*, i8** %6
%38 = load i8*, i8** %7
%39 = call i32 @memxor(i8* %37, i8* %38, i32 16384)
%40 = load i8*, i8** %7
%41 = call i32 @free(i8* %40)
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [30 x i8] c"Cannot allocate needed memory\00"
define void @mixoaep_pad(i8* %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 16384
%4 = tail call dereferenceable_or_null(16384) i8* @malloc(i32 16384)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = tail call i32 @oaep_G(i8* %0, i8* %4, i8* %1)
%12 = tail call i32 @memxor(i8* %3, i8* %4, i32 16384)
%13 = tail call i32 @oaep_G(i8* %3, i8* %4, i8* %1)
%14 = tail call i32 @memxor(i8* %0, i8* %4, i32 16384)
%15 = tail call i32 @oaep_G(i8* %0, i8* %4, i8* %1)
%16 = tail call i32 @memxor(i8* %3, i8* %4, i32 16384)
%17 = tail call i32 @free(i8* %4)
ret void
}