#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 */
char *malloc(int);
char *generateData() {
  char *ret = malloc(256 * 256 * 2);
  char *curr = ret;
  for (int i = 0; i < 256; i++) {
    for (int j = 0; j < 256; j++) {
      *curr = i;
      curr++;
      *curr = j;
      curr++;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<generateData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x20000,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    11a5 <generateData+0x95>
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    1192 <generateData+0x82>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <generateData+0x39>
jmp    1197 <generateData+0x87>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <generateData+0x25>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateData>:
push   %rax
mov    $0x20000,%edi
call   1030 <malloc@plt>
xor    %ecx,%ecx
movdqa 0xeda(%rip),%xmm8
movdqa 0xee1(%rip),%xmm9
movdqa 0xee9(%rip),%xmm2
movdqa 0xef1(%rip),%xmm3
movdqa 0xef9(%rip),%xmm4
mov    %rax,%rdx
nopw   0x0(%rax,%rax,1)
lea    0x200(%rdx),%rsi
movd   %ecx,%xmm5
punpcklbw %xmm5,%xmm5
pshuflw $0x0,%xmm5,%xmm1
mov    $0x18,%edi
movdqa %xmm8,%xmm6
xchg   %ax,%ax
movdqa %xmm6,%xmm7
paddb  %xmm9,%xmm7
movdqa %xmm1,%xmm5
punpcklbw %xmm6,%xmm5
movdqu %xmm5,-0x30(%rdx,%rdi,2)
movdqa %xmm1,%xmm5
punpcklbw %xmm7,%xmm5
movdqu %xmm5,-0x20(%rdx,%rdi,2)
movdqa %xmm6,%xmm5
paddb  %xmm2,%xmm5
movdqa %xmm6,%xmm7
paddb  %xmm3,%xmm7
movdqa %xmm1,%xmm0
punpcklbw %xmm5,%xmm0
movdqu %xmm0,-0x10(%rdx,%rdi,2)
movdqa %xmm1,%xmm0
punpcklbw %xmm7,%xmm0
movdqu %xmm0,(%rdx,%rdi,2)
paddb  %xmm4,%xmm6
add    $0x20,%rdi
cmp    $0x118,%rdi
jne    1170 <generateData+0x60>
add    $0x1,%ecx
mov    %rsi,%rdx
cmp    $0x100,%ecx
jne    1150 <generateData+0x40>
pop    %rcx
ret

LLVM IR (-O0):
define i8* @generateData() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = call i8* @malloc(i32 131072)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
store i8* %6, i8** %2
store i32 0, i32* %3
br label %7
7: ; preds = %29, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 256
br i1 %9, label %10, label %32
10: ; preds = %7
store i32 0, i32* %4
br label %11
11: ; preds = %25, %10
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 256
br i1 %13, label %14, label %28
14: ; preds = %11
%15 = load i32, i32* %3
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %2
store i8 %16, i8* %17
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
%20 = load i32, i32* %4
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %2
store i8 %21, i8* %22
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %2
br label %25
25: ; preds = %14
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %11
28: ; preds = %11
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %7
32: ; preds = %7
%33 = load i8*, i8** %1
ret i8* %33
}

LLVM IR (-O2):
define noalias i8* @generateData() {
%1 = tail call dereferenceable_or_null(131072) i8* @malloc(i32 131072)
br label %2
2: ; preds = %0, %40
%3 = phi i32 [ 0, %0 ], [ %41, %40 ]
%4 = phi i8* [ %1, %0 ], [ %6, %40 ]
%5 = trunc i32 %3 to i8
%6 = getelementptr i8, i8* %4, i64 512
%7 = insertelement <8 x i8> poison, i8 %5, i64 0
%8 = shufflevector <8 x i8> %7, <8 x i8> poison, <8 x i32> zeroinitializer
%9 = insertelement <8 x i8> poison, i8 %5, i64 0
%10 = shufflevector <8 x i8> %9, <8 x i8> poison, <8 x i32> zeroinitializer
br label %11
11: ; preds = %11, %2
%12 = phi i64 [ 0, %2 ], [ %36, %11 ]
%13 = phi <8 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>, %2 ], [ %37, %11 ]
%14 = shl nuw i64 %12, 1
%15 = shl nuw i64 %12, 1
%16 = or i64 %15, 16
%17 = add <8 x i8> %13, <i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8>
%18 = getelementptr inbounds i8, i8* %4, i64 %14
%19 = bitcast i8* %18 to <16 x i8>*
%20 = getelementptr inbounds i8, i8* %4, i64 %16
%21 = bitcast i8* %20 to <16 x i8>*
%22 = shufflevector <8 x i8> %8, <8 x i8> %13, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %22, <16 x i8>* %19
%23 = shufflevector <8 x i8> %10, <8 x i8> %17, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %23, <16 x i8>* %21
%24 = or i64 %12, 16
%25 = add <8 x i8> %13, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%26 = shl nuw i64 %24, 1
%27 = shl nuw i64 %24, 1
%28 = or i64 %27, 16
%29 = add <8 x i8> %13, <i8 24, i8 24, i8 24, i8 24, i8 24, i8 24, i8 24, i8 24>
%30 = getelementptr inbounds i8, i8* %4, i64 %26
%31 = bitcast i8* %30 to <16 x i8>*
%32 = getelementptr inbounds i8, i8* %4, i64 %28
%33 = bitcast i8* %32 to <16 x i8>*
%34 = shufflevector <8 x i8> %8, <8 x i8> %25, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %34, <16 x i8>* %31
%35 = shufflevector <8 x i8> %10, <8 x i8> %29, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %35, <16 x i8>* %33
%36 = add nuw nsw i64 %12, 32
%37 = add <8 x i8> %13, <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%38 = icmp eq i64 %36, 256
br i1 %38, label %40, label %11
39: ; preds = %40
ret i8* %1
40: ; preds = %11
%41 = add nuw nsw i32 %3, 1
%42 = icmp eq i32 %41, 256
br i1 %42, label %39, label %2
}