#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);
int main(int argc, char *argv[]) {
  char *mem = malloc(128);
  int i;
  for (i = 0; i < 32; i++)
    mem[i] = i;
  for (i = 0; i < 32; i++)
    mem[i + 64] = mem[i];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x80,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    1163 <main+0x53>
mov    -0x1c(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <main+0x2b>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    119d <main+0x8d>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x40,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116a <main+0x5a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x80,%edi
call   1030 <malloc@plt>
movaps 0xede(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xee4(%rip),%xmm0
movups %xmm0,0x10(%rax)
movb   $0x0,0x40(%rax)
movups 0x1(%rax),%xmm0
movups %xmm0,0x41(%rax)
mov    0x11(%rax),%rcx
mov    %rcx,0x51(%rax)
mov    0x19(%rax),%cl
mov    %cl,0x59(%rax)
mov    0x1a(%rax),%ecx
mov    %ecx,0x5a(%rax)
movzwl 0x1e(%rax),%ecx
mov    %cx,0x5e(%rax)
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%4 = bitcast i8* %3 to <16 x i8>*
store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, <16 x i8>* %4
%5 = getelementptr inbounds i8, i8* %3, i64 16
%6 = bitcast i8* %5 to <16 x i8>*
store <16 x i8> <i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31>, <16 x i8>* %6
%7 = getelementptr inbounds i8, i8* %3, i64 64
store i8 0, i8* %7
%8 = getelementptr inbounds i8, i8* %3, i64 1
%9 = bitcast i8* %8 to <16 x i8>*
%10 = load <16 x i8>, <16 x i8>* %9
%11 = getelementptr inbounds i8, i8* %3, i64 65
%12 = bitcast i8* %11 to <16 x i8>*
store <16 x i8> %10, <16 x i8>* %12
%13 = getelementptr inbounds i8, i8* %3, i64 17
%14 = bitcast i8* %13 to <8 x i8>*
%15 = load <8 x i8>, <8 x i8>* %14
%16 = getelementptr inbounds i8, i8* %3, i64 81
%17 = bitcast i8* %16 to <8 x i8>*
store <8 x i8> %15, <8 x i8>* %17
%18 = getelementptr inbounds i8, i8* %3, i64 25
%19 = load i8, i8* %18
%20 = getelementptr inbounds i8, i8* %3, i64 89
store i8 %19, i8* %20
%21 = getelementptr inbounds i8, i8* %3, i64 26
%22 = load i8, i8* %21
%23 = getelementptr inbounds i8, i8* %3, i64 90
store i8 %22, i8* %23
%24 = getelementptr inbounds i8, i8* %3, i64 27
%25 = load i8, i8* %24
%26 = getelementptr inbounds i8, i8* %3, i64 91
store i8 %25, i8* %26
%27 = getelementptr inbounds i8, i8* %3, i64 28
%28 = load i8, i8* %27
%29 = getelementptr inbounds i8, i8* %3, i64 92
store i8 %28, i8* %29
%30 = getelementptr inbounds i8, i8* %3, i64 29
%31 = load i8, i8* %30
%32 = getelementptr inbounds i8, i8* %3, i64 93
store i8 %31, i8* %32
%33 = getelementptr inbounds i8, i8* %3, i64 30
%34 = load i8, i8* %33
%35 = getelementptr inbounds i8, i8* %3, i64 94
store i8 %34, i8* %35
%36 = getelementptr inbounds i8, i8* %3, i64 31
%37 = load i8, i8* %36
%38 = getelementptr inbounds i8, i8* %3, i64 95
store i8 %37, i8* %38
ret i32 0
}