#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*/ assert(int);
int /*<<< orphan*/ convert(int *, int);
int /*<<< orphan*/ effective_convert(int *, int);
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(int *, int *, int);
int /*<<< orphan*/ randomize(int *, int);
void test(void) {
  int *s = (int *)malloc((sizeof(int) * 9973 * 9973));
  int *e = (int *)malloc((sizeof(int) * 9973 * 9973));
  randomize(s, 9973);
  memcpy(e, s, (sizeof(int) * 9973 * 9973));
  convert(s, 9973);
  effective_convert(e, 9973);
  for (int i = 0; i < 9973; i++)
    for (int j = 0; j < 9973; j++)
      assert(s[i * 9973 + j] == e[i * 9973 + j]);
  free((void *)s);
  free((void *)e);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x17b699e4,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x17b699e4,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x26f5,%esi
call   1090 <randomize@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x17b699e4,%edx
call   1060 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    $0x26f5,%esi
call   1040 <convert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x26f5,%esi
call   1080 <effective_convert@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x26f5,-0x14(%rbp)
jge    124e <test+0xde>
movl   $0x0,-0x18(%rbp)
cmpl   $0x26f5,-0x18(%rbp)
jge    123b <test+0xcb>
mov    -0x8(%rbp),%rax
imul   $0x26f5,-0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
imul   $0x26f5,-0x14(%rbp),%edx
add    -0x18(%rbp),%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11eb <test+0x7b>
jmp    1240 <test+0xd0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d7 <test+0x67>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x17b699e4,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    $0x17b699e4,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    $0x26f5,%esi
call   1090 <randomize@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x17b699e4,%edx
call   1060 <memcpy@plt>
mov    %r15,%rdi
mov    $0x26f5,%esi
call   1040 <convert@plt>
mov    %r14,%rdi
mov    $0x26f5,%esi
call   1080 <effective_convert@plt>
xor    %r12d,%r12d
mov    %r15,%r13
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbp,4),%eax
xor    %edi,%edi
cmp    (%rbx,%rbp,4),%eax
sete   %dil
call   1050 <assert@plt>
add    $0x1,%rbp
cmp    $0x26f5,%rbp
jne    11f0 <test+0x80>
add    $0x1,%r12
add    $0x9bd4,%rbx
add    $0x9bd4,%r13
cmp    $0x26f5,%r12
jne    11e0 <test+0x70>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @test() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = call i64 @malloc(i32 397842916)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %1
%7 = call i64 @malloc(i32 397842916)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %2
%9 = load i32*, i32** %1
%10 = call i32 @randomize(i32* %9, i32 9973)
%11 = load i32*, i32** %2
%12 = load i32*, i32** %1
%13 = call i32 @memcpy(i32* %11, i32* %12, i32 397842916)
%14 = load i32*, i32** %1
%15 = call i32 @convert(i32* %14, i32 9973)
%16 = load i32*, i32** %2
%17 = call i32 @effective_convert(i32* %16, i32 9973)
store i32 0, i32* %3
br label %18
18: ; preds = %49, %0
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 9973
br i1 %20, label %21, label %52
21: ; preds = %18
store i32 0, i32* %4
br label %22
22: ; preds = %45, %21
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 9973
br i1 %24, label %25, label %48
25: ; preds = %22
%26 = load i32*, i32** %1
%27 = load i32, i32* %3
%28 = mul nsw i32 %27, 9973
%29 = load i32, i32* %4
%30 = add nsw i32 %28, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %26, i64 %31
%33 = load i32, i32* %32
%34 = load i32*, i32** %2
%35 = load i32, i32* %3
%36 = mul nsw i32 %35, 9973
%37 = load i32, i32* %4
%38 = add nsw i32 %36, %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %34, i64 %39
%41 = load i32, i32* %40
%42 = icmp eq i32 %33, %41
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
br label %45
45: ; preds = %25
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
store i32 %47, i32* %4
br label %22
48: ; preds = %22
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %18
52: ; preds = %18
%53 = load i32*, i32** %1
%54 = bitcast i32* %53 to i8*
%55 = call i32 @free(i8* %54)
%56 = load i32*, i32** %2
%57 = bitcast i32* %56 to i8*
%58 = call i32 @free(i8* %57)
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i64 @malloc(i32 397842916)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i64 @malloc(i32 397842916)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i32 @randomize(i32* %2, i32 9973)
%6 = tail call i32 @memcpy(i32* %4, i32* %2, i32 397842916)
%7 = tail call i32 @convert(i32* %2, i32 9973)
%8 = tail call i32 @effective_convert(i32* %4, i32 9973)
br label %9
9: ; preds = %0, %17
%10 = phi i64 [ 0, %0 ], [ %18, %17 ]
%11 = mul nuw nsw i64 %10, 9973
br label %20
12: ; preds = %17
%13 = inttoptr i64 %1 to i8*
%14 = tail call i32 @free(i8* %13)
%15 = inttoptr i64 %3 to i8*
%16 = tail call i32 @free(i8* %15)
ret void
17: ; preds = %20
%18 = add nuw nsw i64 %10, 1
%19 = icmp eq i64 %18, 9973
br i1 %19, label %12, label %9
20: ; preds = %9, %20
%21 = phi i64 [ 0, %9 ], [ %30, %20 ]
%22 = add nuw nsw i64 %21, %11
%23 = getelementptr inbounds i32, i32* %2, i64 %22
%24 = load i32, i32* %23
%25 = getelementptr inbounds i32, i32* %4, i64 %22
%26 = load i32, i32* %25
%27 = icmp eq i32 %24, %26
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = add nuw nsw i64 %21, 1
%31 = icmp eq i64 %30, 9973
br i1 %31, label %17, label %20
}