#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*/ strlen(char const *);
int test_case(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ test_mem_eq(char *, int, char *, char *, char const *,
                               int /*<<< orphan*/, char const *,
                               int /*<<< orphan*/);
int test_memory_overflow(void) {
  const char *p = "1234567890123456789012345678901234567890123456789012";
  const char *q = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  return test_case(
      (0), "TEST_mem_eq(p, strlen(p), q, strlen(q))",
      (test_mem_eq(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/test_test.c",
          308, "p", "q", p, strlen(p), q, strlen(q))));
}


x86 assembly (clang, -O0):
<test_memory_overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeeb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    -0x18(%rbp),%r10
lea    0xf0c(%rip),%rdi
mov    $0x134,%esi
lea    0xfad(%rip),%rdx
lea    0xfa8(%rip),%rcx
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1050 <test_mem_eq@plt>
mov    %eax,%edx
xor    %edi,%edi
lea    0xeb9(%rip),%rsi
call   1040 <test_case@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_memory_overflow>:
push   %rbp
push   %r14
push   %rbx
lea    0xec5(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xee9(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xf37(%rip),%rdi
lea    0xfdd(%rip),%rdx
lea    0xfd8(%rip),%rcx
mov    $0x134,%esi
mov    %r14,%r8
mov    %ebp,%r9d
push   %rax
push   %rbx
call   1050 <test_mem_eq@plt>
add    $0x10,%rsp
lea    0xee4(%rip),%rsi
xor    %edi,%edi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <test_case@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"1234567890123456789012345678901234567890123456789012\00"
@.str.1 = [53 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.2 = [40 x i8] c"TEST_mem_eq(p, strlen(p), q, strlen(q))\00"
@.str.3 = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/test_test.c\00"
@.str.4 = [2 x i8] c"p\00"
@.str.5 = [2 x i8] c"q\00"
define i32 @test_memory_overflow() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @strlen(i8* %4)
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @test_mem_eq(i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str.3, i64 0, i64 0), i32 308, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %3, i32 %5, i8* %6, i32 %8)
%10 = call i32 @test_case(i32 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [53 x i8] c"1234567890123456789012345678901234567890123456789012\00"
@.str.1 = [53 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.2 = [40 x i8] c"TEST_mem_eq(p, strlen(p), q, strlen(q))\00"
@.str.3 = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/test_test.c\00"
@.str.4 = [2 x i8] c"p\00"
@.str.5 = [2 x i8] c"q\00"
define i32 @test_memory_overflow() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @test_mem_eq(i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str.3, i64 0, i64 0), i32 308, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = tail call i32 @test_case(i32 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %3)
ret i32 %4
}