int main(void) {
  check_vect();
  long long data[256];
  int i;
  for (i = 0; i < 256; i++) {
    data[i] = i;
    __asm__ volatile("");
  }
  foo(data);
  for (i = 0; i < 256; i++) {
    if (data[i] / 123 != i)
      __builtin_abort();
    __asm__ volatile("");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <check_vect@plt>
movl   $0x0,-0x814(%rbp)
cmpl   $0x100,-0x814(%rbp)
jge    118d <main+0x5d>
movslq -0x814(%rbp),%rcx
movslq -0x814(%rbp),%rax
mov    %rcx,-0x810(%rbp,%rax,8)
ff
mov    -0x814(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x814(%rbp)
jmp    1153 <main+0x23>
lea    -0x810(%rbp),%rdi
mov    $0x0,%al
call   1050 <foo@plt>
movl   $0x0,-0x814(%rbp)
cmpl   $0x100,-0x814(%rbp)
jge    11f7 <main+0xc7>
movslq -0x814(%rbp),%rax
mov    -0x810(%rbp,%rax,8),%rax
ff
mov    $0x7b,%ecx
cqto
idiv   %rcx
movslq -0x814(%rbp),%rcx
cmp    %rcx,%rax
je     11e3 <main+0xb3>
call   1030 <abort@plt>
mov    -0x814(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x814(%rbp)
jmp    11a5 <main+0x75>
xor    %eax,%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x800,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <check_vect@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1150 <main+0x20>
xor    %ebx,%ebx
mov    %rsp,%rdi
xor    %eax,%eax
call   1050 <foo@plt>
movabs $0x8534085340853409,%rsi
08 34 85
nopw   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,8),%rcx
mov    %rcx,%rax
imul   %rsi
add    %rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x6,%rdx
add    %rax,%rdx
cmp    %rdx,%rbx
jne    11b8 <main+0x88>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i64]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @check_vect()
store i32 0, i32* %3
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 256
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [256 x i64], [256 x i64]* %2, i64 0, i64 %12
store i64 %10, i64* %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
%18 = getelementptr inbounds [256 x i64], [256 x i64]* %2, i64 0, i64 0
%19 = call i32 (i64*, ...) bitcast (i32 (...)* @foo to i32 (i64*, ...)*)(i64* %18)
store i32 0, i32* %3
br label %20
20: ; preds = %34, %17
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 256
br i1 %22, label %23, label %37
23: ; preds = %20
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [256 x i64], [256 x i64]* %2, i64 0, i64 %25
%27 = load i64, i64* %26
%28 = sdiv i64 %27, 123
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = icmp ne i64 %28, %30
br i1 %31, label %32, label %33
32: ; preds = %23
unreachable
33: ; preds = %23
br label %34
34: ; preds = %33
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %20
37: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [256 x i64]
%2 = tail call i32 (...) @check_vect()
%3 = bitcast [256 x i64]* %1 to i8*
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %7, %4 ]
%6 = getelementptr inbounds [256 x i64], [256 x i64]* %1, i64 0, i64 %5
store i64 %5, i64* %6
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
%7 = add nuw nsw i64 %5, 1
%8 = icmp eq i64 %7, 256
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = getelementptr inbounds [256 x i64], [256 x i64]* %1, i64 0, i64 0
%11 = call i32 (i64*, ...) bitcast (i32 (...)* @foo to i32 (i64*, ...)*)(i64* %10)
br label %12
12: ; preds = %9, %19
%13 = phi i64 [ 0, %9 ], [ %20, %19 ]
%14 = getelementptr inbounds [256 x i64], [256 x i64]* %1, i64 0, i64 %13
%15 = load i64, i64* %14
%16 = sdiv i64 %15, 123
%17 = icmp eq i64 %16, %13
br i1 %17, label %19, label %18
18: ; preds = %12
unreachable
19: ; preds = %12
%20 = add nuw nsw i64 %13, 1
%21 = icmp eq i64 %20, 256
br i1 %21, label %22, label %12
22: ; preds = %19
ret i32 0
}