#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*/ check_in();
int /*<<< orphan*/ check_out();
unsigned char *malloc(int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ memcpyi(unsigned char *, unsigned char *, int);
int main(void) {
  int nSize = 1920 * 16;
  unsigned char *pSrc = malloc(nSize);
  unsigned char *pDst = malloc(nSize);
  check_in();
  for (int i = 1080 / 16; i--;) {
    memcpyi(pDst, pSrc, nSize / 4);
  }
  check_out();
  check_in();
  for (int i = 1080 / 16; i--;) {
    memcpy(pDst, pSrc, nSize);
  }
  check_out();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7800,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <check_in@plt>
movl   $0x43,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     11bf <main+0x6f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1060 <memcpyi@plt>
jmp    118c <main+0x3c>
mov    $0x0,%al
call   1070 <check_out@plt>
mov    $0x0,%al
call   1030 <check_in@plt>
movl   $0x43,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x20(%rbp)
cmp    $0x0,%eax
je     11fd <main+0xad>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%edx
call   1040 <memcpy@plt>
jmp    11d4 <main+0x84>
mov    $0x0,%al
call   1070 <check_out@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x7800,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x7800,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <check_in@plt>
mov    $0xffffffbd,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1e00,%edx
call   1060 <memcpyi@plt>
inc    %ebp
jne    1180 <main+0x30>
xor    %eax,%eax
call   1070 <check_out@plt>
xor    %eax,%eax
call   1030 <check_in@plt>
mov    $0xffffffbd,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x7800,%edx
call   1040 <memcpy@plt>
inc    %ebp
jne    11b0 <main+0x60>
xor    %eax,%eax
call   1070 <check_out@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 30720, i32* %2
%7 = load i32, i32* %2
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %3
%9 = load i32, i32* %2
%10 = call i8* @malloc(i32 %9)
store i8* %10, i8** %4
%11 = call i32 (...) @check_in()
store i32 67, i32* %5
br label %12
12: ; preds = %16, %0
%13 = load i32, i32* %5
%14 = add nsw i32 %13, -1
store i32 %14, i32* %5
%15 = icmp ne i32 %13, 0
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = load i8*, i8** %3
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 4
%21 = call i32 @memcpyi(i8* %17, i8* %18, i32 %20)
br label %12
22: ; preds = %12
%23 = call i32 (...) @check_out()
%24 = call i32 (...) @check_in()
store i32 67, i32* %6
br label %25
25: ; preds = %29, %22
%26 = load i32, i32* %6
%27 = add nsw i32 %26, -1
store i32 %27, i32* %6
%28 = icmp ne i32 %26, 0
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = load i8*, i8** %4
%31 = load i8*, i8** %3
%32 = load i32, i32* %2
%33 = call i32 @memcpy(i8* %30, i8* %31, i32 %32)
br label %25
34: ; preds = %25
%35 = call i32 (...) @check_out()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call dereferenceable_or_null(30720) i8* @malloc(i32 30720)
%2 = tail call dereferenceable_or_null(30720) i8* @malloc(i32 30720)
%3 = tail call i32 (...) @check_in()
br label %7
4: ; preds = %7
%5 = tail call i32 (...) @check_out()
%6 = tail call i32 (...) @check_in()
br label %14
7: ; preds = %0, %7
%8 = phi i32 [ 67, %0 ], [ %9, %7 ]
%9 = add nsw i32 %8, -1
%10 = tail call i32 @memcpyi(i8* %2, i8* %1, i32 7680)
%11 = icmp eq i32 %9, 0
br i1 %11, label %4, label %7
12: ; preds = %14
%13 = tail call i32 (...) @check_out()
ret i32 0
14: ; preds = %4, %14
%15 = phi i32 [ 67, %4 ], [ %16, %14 ]
%16 = add nsw i32 %15, -1
%17 = tail call i32 @memcpy(i8* %2, i8* %1, i32 30720)
%18 = icmp eq i32 %16, 0
br i1 %18, label %12, label %14
}