#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*/ RSA_F_RSA_PADDING_ADD_NONE;
int /*<<< orphan*/ RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE;
int /*<<< orphan*/ RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE;
int /*<<< orphan*/ RSAerr(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char const *, unsigned int);
int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from,
                         int flen) {
  if (flen > tlen) {
    RSAerr(RSA_F_RSA_PADDING_ADD_NONE, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
    return (0);
  }
  if (flen < tlen) {
    RSAerr(RSA_F_RSA_PADDING_ADD_NONE, RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE);
    return (0);
  }
  memcpy(to, from, (unsigned int)flen);
  return (1);
}


x86 assembly (clang, -O0):
<RSA_padding_add_none>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1165 <RSA_padding_add_none+0x45>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
call   1040 <RSAerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ab <RSA_padding_add_none+0x8b>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1194 <RSA_padding_add_none+0x74>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
mov    0x2e57(%rip),%rax
mov    (%rax),%esi
call   1040 <RSAerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ab <RSA_padding_add_none+0x8b>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <memcpy@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RSA_padding_add_none>:
push   %rax
cmp    %esi,%ecx
jle    1137 <RSA_padding_add_none+0x17>
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
mov    0x2eab(%rip),%rax
jmp    1149 <RSA_padding_add_none+0x29>
jge    1154 <RSA_padding_add_none+0x34>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
call   1040 <RSAerr@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    %rdx,%rsi
mov    %ecx,%edx
call   1030 <memcpy@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RSA_F_RSA_PADDING_ADD_NONE = global i32 0
@RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE = global i32 0
@RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE = global i32 0
define i32 @RSA_padding_add_none(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = load i32, i32* %7
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %4
%14 = load i32, i32* @RSA_F_RSA_PADDING_ADD_NONE
%15 = load i32, i32* @RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE
%16 = call i32 @RSAerr(i32 %14, i32 %15)
store i32 0, i32* %5
br label %30
17: ; preds = %4
%18 = load i32, i32* %9
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* @RSA_F_RSA_PADDING_ADD_NONE
%23 = load i32, i32* @RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE
%24 = call i32 @RSAerr(i32 %22, i32 %23)
store i32 0, i32* %5
br label %30
25: ; preds = %17
%26 = load i8*, i8** %6
%27 = load i8*, i8** %8
%28 = load i32, i32* %9
%29 = call i32 @memcpy(i8* %26, i8* %27, i32 %28)
store i32 1, i32* %5
br label %30
30: ; preds = %25, %21, %13
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
@RSA_F_RSA_PADDING_ADD_NONE = global i32 0
@RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE = global i32 0
@RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE = global i32 0
define i32 @RSA_padding_add_none(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp sgt i32 %3, %1
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = load i32, i32* @RSA_F_RSA_PADDING_ADD_NONE
%8 = load i32, i32* @RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE
%9 = tail call i32 @RSAerr(i32 %7, i32 %8)
br label %18
10: ; preds = %4
%11 = icmp slt i32 %3, %1
br i1 %11, label %12, label %16
12: ; preds = %10
%13 = load i32, i32* @RSA_F_RSA_PADDING_ADD_NONE
%14 = load i32, i32* @RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE
%15 = tail call i32 @RSAerr(i32 %13, i32 %14)
br label %18
16: ; preds = %10
%17 = tail call i32 @memcpy(i8* %0, i8* %2, i32 %3)
br label %18
18: ; preds = %16, %12, %6
%19 = phi i32 [ 0, %6 ], [ 0, %12 ], [ 1, %16 ]
ret i32 %19
}