#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*/ doloop(float **, float *, int *, int *);
int /*<<< orphan*/ init(int *, int *);
int main() {
  float *a[512];
  float b[512];
  int c[512] = {0};
  int d[512] = {0};
  init(c, d);
  doloop(a, b, c, d);
  for (int i = 0; i < 512; ++i) {
    if (a[i] != &b[i] + c[i] * d[i]) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2820,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2010(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1040 <memset@plt>
lea    -0x2810(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1040 <memset@plt>
lea    -0x2010(%rbp),%rdi
lea    -0x2810(%rbp),%rsi
call   1050 <init@plt>
lea    -0x1010(%rbp),%rdi
lea    -0x1810(%rbp),%rsi
lea    -0x2010(%rbp),%rdx
lea    -0x2810(%rbp),%rcx
call   1030 <doloop@plt>
movl   $0x0,-0x2814(%rbp)
cmpl   $0x200,-0x2814(%rbp)
jge    122f <main+0xff>
movslq -0x2814(%rbp),%rax
mov    -0x1010(%rbp,%rax,8),%rax
ff
movslq -0x2814(%rbp),%rdx
lea    -0x1810(%rbp),%rcx
shl    $0x2,%rdx
add    %rdx,%rcx
movslq -0x2814(%rbp),%rdx
mov    -0x2010(%rbp,%rdx,4),%edx
movslq -0x2814(%rbp),%rsi
imul   -0x2810(%rbp,%rsi,4),%edx
ff
movslq %edx,%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
je     1216 <main+0xe6>
movl   $0x1,-0x4(%rbp)
jmp    1236 <main+0x106>
jmp    121b <main+0xeb>
mov    -0x2814(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2814(%rbp)
jmp    11a6 <main+0x76>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x2800,%rsp
lea    0x800(%rsp),%r14
xor    %ebx,%ebx
mov    $0x800,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rsp,%r15
mov    $0x800,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <init@plt>
lea    0x1800(%rsp),%rdi
lea    0x1000(%rsp),%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1030 <doloop@plt>
nopl   (%rax)
movslq 0x800(%rsp,%rbx,1),%rax
movslq (%rsp,%rbx,1),%rcx
imul   %rax,%rcx
lea    (%rbx,%rcx,4),%rax
lea    (%rsp,%rax,1),%rcx
add    $0x1000,%rcx
mov    $0x1,%eax
cmp    0x1800(%rsp,%rbx,2),%rcx
jne    11f6 <main+0xc6>
movslq 0x804(%rsp,%rbx,1),%rcx
movslq 0x4(%rsp,%rbx,1),%rdx
imul   %rcx,%rdx
lea    (%rbx,%rdx,4),%rcx
add    %rsp,%rcx
add    $0x1004,%rcx
cmp    0x1808(%rsp,%rbx,2),%rcx
jne    11f6 <main+0xc6>
add    $0x8,%rbx
cmp    $0x800,%rbx
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x2800,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [512 x float*]
%3 = alloca [512 x float]
%4 = alloca [512 x i32]
%5 = alloca [512 x i32]
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [512 x i32]* %4 to i8*
%8 = bitcast [512 x i32]* %5 to i8*
%9 = getelementptr inbounds [512 x i32], [512 x i32]* %4, i64 0, i64 0
%10 = getelementptr inbounds [512 x i32], [512 x i32]* %5, i64 0, i64 0
%11 = call i32 @init(i32* %9, i32* %10)
%12 = getelementptr inbounds [512 x float*], [512 x float*]* %2, i64 0, i64 0
%13 = getelementptr inbounds [512 x float], [512 x float]* %3, i64 0, i64 0
%14 = getelementptr inbounds [512 x i32], [512 x i32]* %4, i64 0, i64 0
%15 = getelementptr inbounds [512 x i32], [512 x i32]* %5, i64 0, i64 0
%16 = call i32 @doloop(float** %12, float* %13, i32* %14, i32* %15)
store i32 0, i32* %6
br label %17
17: ; preds = %42, %0
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 512
br i1 %19, label %20, label %45
20: ; preds = %17
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [512 x float*], [512 x float*]* %2, i64 0, i64 %22
%24 = load float*, float** %23
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [512 x float], [512 x float]* %3, i64 0, i64 %26
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [512 x i32], [512 x i32]* %4, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [512 x i32], [512 x i32]* %5, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = mul nsw i32 %31, %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds float, float* %27, i64 %37
%39 = icmp ne float* %24, %38
br i1 %39, label %40, label %41
40: ; preds = %20
store i32 1, i32* %1
br label %46
41: ; preds = %20
br label %42
42: ; preds = %41
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %17
45: ; preds = %17
store i32 0, i32* %1
br label %46
46: ; preds = %45, %40
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [512 x float*]
%2 = alloca [512 x float]
%3 = alloca [512 x i32]
%4 = alloca [512 x i32]
%5 = bitcast [512 x float*]* %1 to i8*
%6 = bitcast [512 x float]* %2 to i8*
%7 = bitcast [512 x i32]* %3 to i8*
%8 = bitcast [512 x i32]* %4 to i8*
%9 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 0
%10 = getelementptr inbounds [512 x i32], [512 x i32]* %4, i64 0, i64 0
%11 = call i32 @init(i32* %9, i32* %10)
%12 = getelementptr inbounds [512 x float*], [512 x float*]* %1, i64 0, i64 0
%13 = getelementptr inbounds [512 x float], [512 x float]* %2, i64 0, i64 0
%14 = call i32 @doloop(float** %12, float* %13, i32* %9, i32* %10)
br label %31
15: ; preds = %31
%16 = or i64 %32, 1
%17 = getelementptr inbounds [512 x float*], [512 x float*]* %1, i64 0, i64 %16
%18 = load float*, float** %17
%19 = getelementptr inbounds [512 x float], [512 x float]* %2, i64 0, i64 %16
%20 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %16
%21 = load i32, i32* %20
%22 = getelementptr inbounds [512 x i32], [512 x i32]* %4, i64 0, i64 %16
%23 = load i32, i32* %22
%24 = mul nsw i32 %23, %21
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds float, float* %19, i64 %25
%27 = icmp eq float* %18, %26
br i1 %27, label %28, label %44
28: ; preds = %15
%29 = add nuw nsw i64 %32, 2
%30 = icmp eq i64 %29, 512
br i1 %30, label %44, label %31
31: ; preds = %28, %0
%32 = phi i64 [ 0, %0 ], [ %29, %28 ]
%33 = getelementptr inbounds [512 x float*], [512 x float*]* %1, i64 0, i64 %32
%34 = load float*, float** %33
%35 = getelementptr inbounds [512 x float], [512 x float]* %2, i64 0, i64 %32
%36 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 %32
%37 = load i32, i32* %36
%38 = getelementptr inbounds [512 x i32], [512 x i32]* %4, i64 0, i64 %32
%39 = load i32, i32* %38
%40 = mul nsw i32 %39, %37
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds float, float* %35, i64 %41
%43 = icmp eq float* %34, %42
br i1 %43, label %15, label %44
44: ; preds = %28, %15, %31
%45 = phi i32 [ 1, %31 ], [ 1, %15 ], [ 0, %28 ]
ret i32 %45
}