#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int main() {
  int i;
  int *buffer;
  buffer = (int *)malloc(sizeof(int) * 1000);
  int *set_label_l = (int *)0x80000000;
  int *set_label_h = (int *)0x80000001;
  i = *set_label_h;
  for (i = 0; i < 1000; i++)
    buffer[i] = i;
  printf("finish setting H label!\n");
  i = *set_label_l;
  for (i = 0; i < 1000; i++)
    buffer[i] = -i;
  printf("finish setting L label!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xfa0,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x80000000,%eax
mov    %rax,-0x18(%rbp)
mov    $0x80000001,%eax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1188 <main+0x68>
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115f <main+0x3f>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11cf <main+0xaf>
xor    %edx,%edx
sub    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a4 <main+0x84>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xfa0,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
movdqa 0xeca(%rip),%xmm0
xor    %eax,%eax
movdqa 0xecf(%rip),%xmm8
movdqa 0xed6(%rip),%xmm9
movdqa 0xedd(%rip),%xmm10
movdqa 0xee4(%rip),%xmm11
movdqa 0xeeb(%rip),%xmm12
movdqa 0xef3(%rip),%xmm6
movdqa 0xefb(%rip),%xmm7
movdqa 0xf13(%rip),%xmm1
movdqa 0xf1b(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm0,%xmm3
paddd  %xmm8,%xmm3
movdqu %xmm0,(%rbx,%rax,4)
movdqu %xmm3,0x10(%rbx,%rax,4)
movdqa %xmm0,%xmm3
paddd  %xmm9,%xmm3
movdqa %xmm0,%xmm4
paddd  %xmm10,%xmm4
movdqu %xmm3,0x20(%rbx,%rax,4)
movdqu %xmm4,0x30(%rbx,%rax,4)
movdqa %xmm0,%xmm3
paddd  %xmm11,%xmm3
movdqa %xmm0,%xmm4
paddd  %xmm12,%xmm4
movdqu %xmm3,0x40(%rbx,%rax,4)
movdqu %xmm4,0x50(%rbx,%rax,4)
movdqa %xmm0,%xmm3
paddd  %xmm6,%xmm3
movdqa %xmm0,%xmm4
paddd  %xmm7,%xmm4
movdqu %xmm3,0x60(%rbx,%rax,4)
movdqu %xmm4,0x70(%rbx,%rax,4)
movdqa %xmm0,%xmm3
paddd  0xe78(%rip),%xmm3
movdqa %xmm0,%xmm4
paddd  %xmm1,%xmm4
movdqu %xmm3,0x80(%rbx,%rax,4)
movdqu %xmm4,0x90(%rbx,%rax,4)
add    $0x28,%rax
paddd  %xmm2,%xmm0
cmp    $0x3e8,%rax
jne    1190 <main+0x70>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
movdqa 0xe35(%rip),%xmm10
movdqa 0xdad(%rip),%xmm0
mov    $0x1c,%eax
movdqa 0xe50(%rip),%xmm3
movdqa 0xe57(%rip),%xmm8
movdqa 0xe5e(%rip),%xmm9
movdqa 0xe66(%rip),%xmm4
movdqa 0xe6e(%rip),%xmm5
movdqa 0xe76(%rip),%xmm6
movdqa 0xe7e(%rip),%xmm7
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
pxor   %xmm2,%xmm2
psubd  %xmm0,%xmm2
movdqa %xmm3,%xmm1
psubd  %xmm0,%xmm1
movdqu %xmm2,-0x70(%rbx,%rax,4)
movdqu %xmm1,-0x60(%rbx,%rax,4)
cmp    $0x3fc,%rax
je     1327 <main+0x207>
movdqa %xmm8,%xmm1
psubd  %xmm0,%xmm1
movdqa %xmm9,%xmm2
psubd  %xmm0,%xmm2
movdqu %xmm1,-0x50(%rbx,%rax,4)
movdqu %xmm2,-0x40(%rbx,%rax,4)
movdqa %xmm4,%xmm1
psubd  %xmm0,%xmm1
movdqa %xmm5,%xmm2
psubd  %xmm0,%xmm2
movdqu %xmm1,-0x30(%rbx,%rax,4)
movdqu %xmm2,-0x20(%rbx,%rax,4)
movdqa %xmm6,%xmm1
psubd  %xmm0,%xmm1
movdqa %xmm7,%xmm2
psubd  %xmm0,%xmm2
movdqu %xmm1,-0x10(%rbx,%rax,4)
movdqu %xmm2,(%rbx,%rax,4)
paddd  %xmm10,%xmm0
add    $0x20,%rax
jmp    12a0 <main+0x180>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"finish setting H label!\0A\00"
@.str.1 = [25 x i8] c"finish setting L label!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32 0, i32* %1
%6 = call i64 @malloc(i32 4000)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %3
store i32* inttoptr (i64 2147483648 to i32*), i32** %4
store i32* inttoptr (i64 2147483649 to i32*), i32** %5
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
store i32 %9, i32* %2
store i32 0, i32* %2
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32*, i32** %3
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
store i32 %14, i32* %18
br label %19
19: ; preds = %13
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %10
22: ; preds = %10
%23 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
store i32 %25, i32* %2
store i32 0, i32* %2
br label %26
26: ; preds = %36, %22
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 1000
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = load i32, i32* %2
%31 = sub nsw i32 0, %30
%32 = load i32*, i32** %3
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
store i32 %31, i32* %35
br label %36
36: ; preds = %29
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %26
39: ; preds = %26
%40 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [24 x i8] c"finish setting H label!\00"
@str.2 = [24 x i8] c"finish setting L label!\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 4000)
%2 = inttoptr i64 %1 to i32*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %39, %3 ]
%5 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %0 ], [ %40, %3 ]
%6 = add <4 x i32> %5, <i32 4, i32 4, i32 4, i32 4>
%7 = getelementptr inbounds i32, i32* %2, i64 %4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> %5, <4 x i32>* %8
%9 = getelementptr inbounds i32, i32* %7, i64 4
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> %6, <4 x i32>* %10
%11 = add nuw nsw i64 %4, 8
%12 = add <4 x i32> %5, <i32 8, i32 8, i32 8, i32 8>
%13 = add <4 x i32> %5, <i32 12, i32 12, i32 12, i32 12>
%14 = getelementptr inbounds i32, i32* %2, i64 %11
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %15
%16 = getelementptr inbounds i32, i32* %14, i64 4
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> %13, <4 x i32>* %17
%18 = add nuw nsw i64 %4, 16
%19 = add <4 x i32> %5, <i32 16, i32 16, i32 16, i32 16>
%20 = add <4 x i32> %5, <i32 20, i32 20, i32 20, i32 20>
%21 = getelementptr inbounds i32, i32* %2, i64 %18
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> %19, <4 x i32>* %22
%23 = getelementptr inbounds i32, i32* %21, i64 4
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> %20, <4 x i32>* %24
%25 = add nuw nsw i64 %4, 24
%26 = add <4 x i32> %5, <i32 24, i32 24, i32 24, i32 24>
%27 = add <4 x i32> %5, <i32 28, i32 28, i32 28, i32 28>
%28 = getelementptr inbounds i32, i32* %2, i64 %25
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> %26, <4 x i32>* %29
%30 = getelementptr inbounds i32, i32* %28, i64 4
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> %27, <4 x i32>* %31
%32 = add nuw nsw i64 %4, 32
%33 = add <4 x i32> %5, <i32 32, i32 32, i32 32, i32 32>
%34 = add <4 x i32> %5, <i32 36, i32 36, i32 36, i32 36>
%35 = getelementptr inbounds i32, i32* %2, i64 %32
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> %33, <4 x i32>* %36
%37 = getelementptr inbounds i32, i32* %35, i64 4
%38 = bitcast i32* %37 to <4 x i32>*
store <4 x i32> %34, <4 x i32>* %38
%39 = add nuw nsw i64 %4, 40
%40 = add <4 x i32> %5, <i32 40, i32 40, i32 40, i32 40>
%41 = icmp eq i64 %39, 1000
br i1 %41, label %42, label %3
42: ; preds = %3
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %44
44: ; preds = %55, %42
%45 = phi i64 [ 0, %42 ], [ %76, %55 ]
%46 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %42 ], [ %77, %55 ]
%47 = getelementptr inbounds i32, i32* %2, i64 %45
%48 = sub <4 x i32> zeroinitializer, %46
%49 = sub <4 x i32> <i32 -4, i32 -4, i32 -4, i32 -4>, %46
%50 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> %48, <4 x i32>* %50
%51 = getelementptr inbounds i32, i32* %47, i64 4
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> %49, <4 x i32>* %52
%53 = or i64 %45, 8
%54 = icmp eq i64 %53, 1000
br i1 %54, label %78, label %55
55: ; preds = %44
%56 = getelementptr inbounds i32, i32* %2, i64 %53
%57 = sub <4 x i32> <i32 -8, i32 -8, i32 -8, i32 -8>, %46
%58 = sub <4 x i32> <i32 -12, i32 -12, i32 -12, i32 -12>, %46
%59 = bitcast i32* %56 to <4 x i32>*
store <4 x i32> %57, <4 x i32>* %59
%60 = getelementptr inbounds i32, i32* %56, i64 4
%61 = bitcast i32* %60 to <4 x i32>*
store <4 x i32> %58, <4 x i32>* %61
%62 = or i64 %45, 16
%63 = getelementptr inbounds i32, i32* %2, i64 %62
%64 = sub <4 x i32> <i32 -16, i32 -16, i32 -16, i32 -16>, %46
%65 = sub <4 x i32> <i32 -20, i32 -20, i32 -20, i32 -20>, %46
%66 = bitcast i32* %63 to <4 x i32>*
store <4 x i32> %64, <4 x i32>* %66
%67 = getelementptr inbounds i32, i32* %63, i64 4
%68 = bitcast i32* %67 to <4 x i32>*
store <4 x i32> %65, <4 x i32>* %68
%69 = or i64 %45, 24
%70 = getelementptr inbounds i32, i32* %2, i64 %69
%71 = sub <4 x i32> <i32 -24, i32 -24, i32 -24, i32 -24>, %46
%72 = sub <4 x i32> <i32 -28, i32 -28, i32 -28, i32 -28>, %46
%73 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> %71, <4 x i32>* %73
%74 = getelementptr inbounds i32, i32* %70, i64 4
%75 = bitcast i32* %74 to <4 x i32>*
store <4 x i32> %72, <4 x i32>* %75
%76 = add nuw nsw i64 %45, 32
%77 = add <4 x i32> %46, <i32 32, i32 32, i32 32, i32 32>
br label %44
78: ; preds = %44
%79 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}