#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*/ ogLogMacroBackEnd(char *, char *, char *, int);
int memoryClear(void *memoryPointerV, size_t bytesize) {
  volatile unsigned char *memoryPointer = NULL;
  if (memoryPointerV == NULL) {
    (ogLogMacroBackEnd(("Error"),
                       ("Something was NULL that shouldn't have been"),
                       ("/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/onionget/"
                        "onionget/refs/heads/master/source/memoryManager.c"),
                       (45)));
    return 0;
  }
  memoryPointer = memoryPointerV;
  while (bytesize--) {
    *memoryPointer++ = 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<memoryClear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115e <memoryClear+0x4e>
lea    0xec6(%rip),%rdi
lea    0xec5(%rip),%rsi
lea    0xeea(%rip),%rdx
mov    $0x2d,%ecx
call   1030 <ogLogMacroBackEnd@plt>
movl   $0x0,-0x4(%rbp)
jmp    119d <memoryClear+0x8d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     1196 <memoryClear+0x86>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
jmp    1166 <memoryClear+0x56>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memoryClear>:
push   %rax
test   %rdi,%rdi
je     1182 <memoryClear+0x72>
mov    $0x1,%eax
test   %rsi,%rsi
je     1180 <memoryClear+0x70>
lea    -0x1(%rsi),%r8
mov    %rsi,%rcx
and    $0x7,%rcx
je     1143 <memoryClear+0x33>
xor    %edx,%edx
nop
movb   $0x0,(%rdi,%rdx,1)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1130 <memoryClear+0x20>
add    %rdx,%rdi
sub    %rdx,%rsi
cmp    $0x7,%r8
jb     1180 <memoryClear+0x70>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rdi,%rcx,1)
movb   $0x0,0x1(%rdi,%rcx,1)
movb   $0x0,0x2(%rdi,%rcx,1)
movb   $0x0,0x3(%rdi,%rcx,1)
movb   $0x0,0x4(%rdi,%rcx,1)
movb   $0x0,0x5(%rdi,%rcx,1)
movb   $0x0,0x6(%rdi,%rcx,1)
movb   $0x0,0x7(%rdi,%rcx,1)
add    $0x8,%rcx
cmp    %rcx,%rsi
jne    1150 <memoryClear+0x40>
pop    %rcx
ret
lea    0xe77(%rip),%rdi
lea    0xe76(%rip),%rsi
lea    0xe9b(%rip),%rdx
mov    $0x2d,%ecx
call   1030 <ogLogMacroBackEnd@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Error\00"
@.str.1 = [44 x i8] c"Something was NULL that shouldn't have been\00"
@.str.2 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/onionget/onionget/refs/heads/master/source/memoryManager.c\00"
define i32 @memoryClear(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* null, i8** %6
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @ogLogMacroBackEnd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.2, i64 0, i64 0), i32 45)
store i32 0, i32* %3
br label %21
11: ; preds = %2
%12 = load i8*, i8** %4
store i8* %12, i8** %6
br label %13
13: ; preds = %17, %11
%14 = load i64, i64* %5
%15 = add i64 %14, -1
store i64 %15, i64* %5
%16 = icmp ne i64 %14, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i8*, i8** %6
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %6
store volatile i8 0, i8* %18
br label %13
20: ; preds = %13
store i32 1, i32* %3
br label %21
21: ; preds = %20, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [6 x i8] c"Error\00"
@.str.1 = [44 x i8] c"Something was NULL that shouldn't have been\00"
@.str.2 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/onionget/onionget/refs/heads/master/source/memoryManager.c\00"
define i32 @memoryClear(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %22, label %4
4: ; preds = %2
%5 = icmp eq i64 %1, 0
br i1 %5, label %37, label %6
6: ; preds = %4
%7 = add i64 %1, -1
%8 = and i64 %1, 7
%9 = icmp eq i64 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %6, %10
%11 = phi i8* [ %15, %10 ], [ %0, %6 ]
%12 = phi i64 [ %14, %10 ], [ %1, %6 ]
%13 = phi i64 [ %16, %10 ], [ 0, %6 ]
%14 = add i64 %12, -1
%15 = getelementptr inbounds i8, i8* %11, i64 1
store volatile i8 0, i8* %11
%16 = add i64 %13, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %18, label %10
18: ; preds = %10, %6
%19 = phi i8* [ %0, %6 ], [ %15, %10 ]
%20 = phi i64 [ %1, %6 ], [ %14, %10 ]
%21 = icmp ult i64 %7, 7
br i1 %21, label %37, label %24
22: ; preds = %2
%23 = tail call i32 @ogLogMacroBackEnd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.2, i64 0, i64 0), i32 45)
br label %37
24: ; preds = %18, %24
%25 = phi i8* [ %35, %24 ], [ %19, %18 ]
%26 = phi i64 [ %34, %24 ], [ %20, %18 ]
%27 = getelementptr inbounds i8, i8* %25, i64 1
store volatile i8 0, i8* %25
%28 = getelementptr inbounds i8, i8* %25, i64 2
store volatile i8 0, i8* %27
%29 = getelementptr inbounds i8, i8* %25, i64 3
store volatile i8 0, i8* %28
%30 = getelementptr inbounds i8, i8* %25, i64 4
store volatile i8 0, i8* %29
%31 = getelementptr inbounds i8, i8* %25, i64 5
store volatile i8 0, i8* %30
%32 = getelementptr inbounds i8, i8* %25, i64 6
store volatile i8 0, i8* %31
%33 = getelementptr inbounds i8, i8* %25, i64 7
store volatile i8 0, i8* %32
%34 = add i64 %26, -8
%35 = getelementptr inbounds i8, i8* %25, i64 8
store volatile i8 0, i8* %33
%36 = icmp eq i64 %34, 0
br i1 %36, label %37, label %24
37: ; preds = %18, %24, %4, %22
%38 = phi i32 [ 0, %22 ], [ 1, %4 ], [ 1, %24 ], [ 1, %18 ]
ret i32 %38
}