#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int /*<<< orphan*/ memmove(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ stderr;
int ossl_normalize(uint8_t *inout, int in_size, int out_size) {
  if (in_size != out_size) {
    do {
      if (!(in_size < out_size)) {
        fprintf(stderr, "FAIL %s(%d) : %s\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/hkjn/greygoo/refs/heads/"
                "master/ucryptolib/test.c",
                328, "in_size < out_size");
        abort();
      }
    } while (0);
    memmove(inout + out_size - in_size, inout, in_size);
    for (; in_size < out_size; ++in_size)
      *inout++ = 0;
  }
  return out_size;
}


x86 assembly (clang, -O0):
<ossl_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11f2 <ossl_normalize+0xc2>
jmp    1153 <ossl_normalize+0x23>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     118e <ossl_normalize+0x5e>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
lea    0xe9c(%rip),%rdx
mov    $0x148,%ecx
lea    0xf1b(%rip),%r8
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1193 <ossl_normalize+0x63>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
movslq -0xc(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <memmove@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ed <ossl_normalize+0xbd>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
movl   $0x0,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11be <ossl_normalize+0x8e>
jmp    11f2 <ossl_normalize+0xc2>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ossl_normalize>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
cmp    %edx,%esi
je     1182 <ossl_normalize+0x42>
jge    1189 <ossl_normalize+0x49>
mov    %esi,%ebx
mov    %rdi,%r14
movslq %ebp,%rax
lea    (%rdi,%rax,4),%rdi
movslq %esi,%rax
shl    $0x2,%rax
sub    %rax,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1060 <memmove@plt>
not    %ebx
add    %ebp,%ebx
lea    0x4(,%rbx,4),%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
lea    0xe72(%rip),%rdx
lea    0xef6(%rip),%r8
mov    $0x148,%ecx
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"FAIL %s(%d) : %s\0A\00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hkjn/greygoo/refs/heads/master/ucryptolib/test.c\00"
@.str.2 = [19 x i8] c"in_size < out_size\00"
define i32 @ossl_normalize(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %43
10: ; preds = %3
br label %11
11: ; preds = %10
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 328, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (...) @abort()
unreachable
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = load i32*, i32** %4
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = sub i64 0, %26
%28 = getelementptr inbounds i32, i32* %24, i64 %27
%29 = load i32*, i32** %4
%30 = load i32, i32* %5
%31 = call i32 @memmove(i32* %28, i32* %29, i32 %30)
br label %32
32: ; preds = %39, %20
%33 = load i32, i32* %5
%34 = load i32, i32* %6
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = load i32*, i32** %4
%38 = getelementptr inbounds i32, i32* %37, i32 1
store i32* %38, i32** %4
store i32 0, i32* %37
br label %39
39: ; preds = %36
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %32
42: ; preds = %32
br label %43
43: ; preds = %42, %3
%44 = load i32, i32* %6
ret i32 %44
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"FAIL %s(%d) : %s\0A\00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hkjn/greygoo/refs/heads/master/ucryptolib/test.c\00"
@.str.2 = [19 x i8] c"in_size < out_size\00"
define i32 @ossl_normalize(i32* %0, i32 %1, i32 returned %2) {
%4 = bitcast i32* %0 to i8*
%5 = icmp eq i32 %1, %2
br i1 %5, label %24, label %6
6: ; preds = %3
%7 = icmp slt i32 %1, %2
br i1 %7, label %12, label %8
8: ; preds = %6
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 328, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %6
%13 = sext i32 %2 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = sext i32 %1 to i64
%16 = sub nsw i64 0, %15
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = tail call i32 @memmove(i32* %17, i32* %0, i32 %1)
%19 = xor i32 %1, -1
%20 = add i32 %19, %2
%21 = zext i32 %20 to i64
%22 = shl nuw nsw i64 %21, 2
%23 = add nuw nsw i64 %22, 4
br label %24
24: ; preds = %12, %3
ret i32 %2
}