#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*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i;
  printf("#ifdef SANDYBRIDGE\n");
  printf("#define EVICT_CACHE \\\n");
  printf("\tmov (1) m0.5:ud g0.5:ud FLAGS; \\\n");
  for (i = 0x100; i < ((128 << 10) / 4) - 8; i += 0x8) {
    printf("\tmov (1) m0.2:ud 0x%04x:ud FLAGS; \\\n", i);
    printf("\tWRITE_SCRATCH4(m0); \\\n");
  }
  printf("\tmov (1) m0.2:ud 0x%04x:ud FLAGS; \\\n", i);
  printf("\tWRITE_SCRATCH4(m0)\n");
  printf("#else\n");
  printf("#define EVICT_CACHE\n");
  printf("#endif\n");
}


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)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x100,-0x14(%rbp)
cmpl   $0x7ff8,-0x14(%rbp)
jge    1191 <main+0x81>
mov    -0x14(%rbp),%esi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <main+0x47>
mov    -0x14(%rbp),%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
mov    $0xf8,%ebx
lea    0xeab(%rip),%r14
lea    0xf49(%rip),%r15
nopl   0x0(%rax)
add    $0x8,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
cmp    $0x7ff0,%ebx
jb     1160 <main+0x40>
lea    0xe7a(%rip),%rdi
mov    $0x7ff8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"#ifdef SANDYBRIDGE\0A\00"
@.str.1 = [23 x i8] c"#define EVICT_CACHE \\\0A\00"
@.str.2 = [35 x i8] c"\09mov (1) m0.5:ud g0.5:ud FLAGS; \\\0A\00"
@.str.3 = [37 x i8] c"\09mov (1) m0.2:ud 0x%04x:ud FLAGS; \\\0A\00"
@.str.4 = [24 x i8] c"\09WRITE_SCRATCH4(m0); \\\0A\00"
@.str.5 = [21 x i8] c"\09WRITE_SCRATCH4(m0)\0A\00"
@.str.6 = [7 x i8] c"#else\0A\00"
@.str.7 = [21 x i8] c"#define EVICT_CACHE\0A\00"
@.str.8 = [8 x i8] c"#endif\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
store i32 256, i32* %6
br label %10
10: ; preds = %17, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 32760
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %13
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 8
store i32 %19, i32* %6
br label %10
20: ; preds = %10
%21 = load i32, i32* %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str.3 = [37 x i8] c"\09mov (1) m0.2:ud 0x%04x:ud FLAGS; \\\0A\00"
@str = [19 x i8] c"#ifdef SANDYBRIDGE\00"
@str.9 = [22 x i8] c"#define EVICT_CACHE \\\00"
@str.10 = [34 x i8] c"\09mov (1) m0.5:ud g0.5:ud FLAGS; \\\00"
@str.11 = [20 x i8] c"\09WRITE_SCRATCH4(m0)\00"
@str.12 = [6 x i8] c"#else\00"
@str.13 = [20 x i8] c"#define EVICT_CACHE\00"
@str.14 = [7 x i8] c"#endif\00"
@str.15 = [23 x i8] c"\09WRITE_SCRATCH4(m0); \\\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.10, i64 0, i64 0))
br label %6
6: ; preds = %2, %6
%7 = phi i32 [ 256, %2 ], [ %10, %6 ]
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
%10 = add nuw nsw i32 %7, 8
%11 = icmp ult i32 %7, 32752
br i1 %11, label %6, label %12
12: ; preds = %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 32760)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.12, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.13, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.14, i64 0, i64 0))
ret i32 0
}