#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 */
size_t I(int, int, int);
int calcE(int skip, int sx, int sy, double CEx, double CEy, double *Ez,
          double *Hx, double *Hy, double *oldEz) {
  int t, x, y, in;
  for (y = 1; y < sy - 1; y++)
    for (x = 1; x < sx - 1; x++) {
      in = I(x, y, sx);
      Ez[in] = oldEz[in] + (CEx * (Hy[I(x, y, sx)] - Hy[I(x, y - 1, sx)])) -
               (CEy * (Hx[I(x, y, sx)] - Hx[I(x - 1, y, sx)]));
    }
  return 1;
}


x86 assembly (clang, -O0):
<calcE>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12c7 <calcE+0x1b7>
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12b4 <calcE+0x1a4>
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <I@plt>
mov    %eax,-0x48(%rbp)
mov    0x10(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x38(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <I@plt>
mov    %rax,%rcx
mov    -0x98(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x38(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
sub    $0x1,%esi
mov    -0x8(%rbp),%edx
call   1030 <I@plt>
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x80(%rbp),%xmm1
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <I@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%edi
sub    $0x1,%edi
mov    -0x44(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <I@plt>
movsd  -0x68(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
subsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    115d <calcE+0x4d>
jmp    12b9 <calcE+0x1a9>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1145 <calcE+0x35>
mov    $0x1,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcE>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x30(%rsp)
movsd  %xmm0,0x28(%rsp)
mov    %edx,0x4(%rsp)
cmp    $0x3,%edx
jl     126f <calcE+0x15f>
mov    %r8,%r13
mov    %esi,%r12d
addl   $0xffffffff,0x4(%rsp)
lea    -0x1(%r12),%edx
xorpd  0xeb2(%rip),%xmm1
mov    $0x1,%ebp
movapd %xmm1,0x40(%rsp)
mov    %edx,0x18(%rsp)
mov    %rcx,0x20(%rsp)
mov    0x30(%rsp),%r14
jmp    117d <calcE+0x6d>
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
je     126f <calcE+0x15f>
cmp    $0x3,%r12d
mov    0x90(%rsp),%rbx
jl     1170 <calcE+0x60>
lea    -0x1(%rbp),%eax
mov    %eax,0x1c(%rsp)
mov    $0x1,%r15d
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
call   1030 <I@plt>
cltq
mov    %rax,0x38(%rsp)
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
call   1030 <I@plt>
movsd  (%r14,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r15d,%edi
mov    0x1c(%rsp),%esi
mov    %r12d,%edx
call   1030 <I@plt>
movsd  0x10(%rsp),%xmm0
subsd  (%r14,%rax,8),%xmm0
mulsd  0x28(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
call   1030 <I@plt>
movsd  0x0(%r13,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    -0x1(%r15),%edi
mov    %ebp,%esi
mov    %r12d,%edx
call   1030 <I@plt>
mov    0x18(%rsp),%edx
movapd 0x40(%rsp),%xmm1
mov    0x20(%rsp),%rcx
movsd  0x8(%rsp),%xmm0
subsd  0x0(%r13,%rax,8),%xmm0
mulsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
mov    0x38(%rsp),%rax
movsd  %xmm0,(%rcx,%rax,8)
add    $0x1,%r15d
cmp    %edx,%r15d
jne    11a0 <calcE+0x90>
jmp    1170 <calcE+0x60>
mov    $0x1,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @calcE(i32 %0, i32 %1, i32 %2, double %3, double %4, double* %5, double* %6, double* %7, double* %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store i32 %0, i32* %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store double %3, double* %13
store double %4, double* %14
store double* %5, double** %15
store double* %6, double** %16
store double* %7, double** %17
store double* %8, double** %18
store i32 1, i32* %21
br label %23
23: ; preds = %90, %9
%24 = load i32, i32* %21
%25 = load i32, i32* %12
%26 = sub nsw i32 %25, 1
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %93
28: ; preds = %23
store i32 1, i32* %20
br label %29
29: ; preds = %86, %28
%30 = load i32, i32* %20
%31 = load i32, i32* %11
%32 = sub nsw i32 %31, 1
%33 = icmp slt i32 %30, %32
br i1 %33, label %34, label %89
34: ; preds = %29
%35 = load i32, i32* %20
%36 = load i32, i32* %21
%37 = load i32, i32* %11
%38 = call i64 @I(i32 %35, i32 %36, i32 %37)
%39 = trunc i64 %38 to i32
store i32 %39, i32* %22
%40 = load double*, double** %18
%41 = load i32, i32* %22
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = load double, double* %13
%46 = load double*, double** %17
%47 = load i32, i32* %20
%48 = load i32, i32* %21
%49 = load i32, i32* %11
%50 = call i64 @I(i32 %47, i32 %48, i32 %49)
%51 = getelementptr inbounds double, double* %46, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %17
%54 = load i32, i32* %20
%55 = load i32, i32* %21
%56 = sub nsw i32 %55, 1
%57 = load i32, i32* %11
%58 = call i64 @I(i32 %54, i32 %56, i32 %57)
%59 = getelementptr inbounds double, double* %53, i64 %58
%60 = load double, double* %59
%61 = fsub double %52, %60
%62 = call double @llvm.fmuladd.f64(double %45, double %61, double %44)
%63 = load double, double* %14
%64 = load double*, double** %16
%65 = load i32, i32* %20
%66 = load i32, i32* %21
%67 = load i32, i32* %11
%68 = call i64 @I(i32 %65, i32 %66, i32 %67)
%69 = getelementptr inbounds double, double* %64, i64 %68
%70 = load double, double* %69
%71 = load double*, double** %16
%72 = load i32, i32* %20
%73 = sub nsw i32 %72, 1
%74 = load i32, i32* %21
%75 = load i32, i32* %11
%76 = call i64 @I(i32 %73, i32 %74, i32 %75)
%77 = getelementptr inbounds double, double* %71, i64 %76
%78 = load double, double* %77
%79 = fsub double %70, %78
%80 = fneg double %63
%81 = call double @llvm.fmuladd.f64(double %80, double %79, double %62)
%82 = load double*, double** %15
%83 = load i32, i32* %22
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %82, i64 %84
store double %81, double* %85
br label %86
86: ; preds = %34
%87 = load i32, i32* %20
%88 = add nsw i32 %87, 1
store i32 %88, i32* %20
br label %29
89: ; preds = %29
br label %90
90: ; preds = %89
%91 = load i32, i32* %21
%92 = add nsw i32 %91, 1
store i32 %92, i32* %21
br label %23
93: ; preds = %23
ret i32 1
}

LLVM IR (-O2):
define i32 @calcE(i32 %0, i32 %1, i32 %2, double %3, double %4, double* nocapture writeonly %5, double* nocapture %6, double* nocapture %7, double* nocapture %8) {
%10 = add i32 %2, -1
%11 = icmp sgt i32 %2, 2
br i1 %11, label %12, label %50
12: ; preds = %9
%13 = add i32 %1, -1
%14 = icmp sgt i32 %1, 2
%15 = fneg double %4
br label %16
16: ; preds = %12, %47
%17 = phi i32 [ 1, %12 ], [ %48, %47 ]
br i1 %14, label %18, label %47
18: ; preds = %16
%19 = add nsw i32 %17, -1
br label %20
20: ; preds = %18, %20
%21 = phi i32 [ 1, %18 ], [ %45, %20 ]
%22 = tail call i64 @I(i32 %21, i32 %17, i32 %1)
%23 = shl i64 %22, 32
%24 = ashr exact i64 %23, 32
%25 = getelementptr inbounds double, double* %8, i64 %24
%26 = load double, double* %25
%27 = tail call i64 @I(i32 %21, i32 %17, i32 %1)
%28 = getelementptr inbounds double, double* %7, i64 %27
%29 = load double, double* %28
%30 = tail call i64 @I(i32 %21, i32 %19, i32 %1)
%31 = getelementptr inbounds double, double* %7, i64 %30
%32 = load double, double* %31
%33 = fsub double %29, %32
%34 = tail call double @llvm.fmuladd.f64(double %3, double %33, double %26)
%35 = tail call i64 @I(i32 %21, i32 %17, i32 %1)
%36 = getelementptr inbounds double, double* %6, i64 %35
%37 = load double, double* %36
%38 = add nsw i32 %21, -1
%39 = tail call i64 @I(i32 %38, i32 %17, i32 %1)
%40 = getelementptr inbounds double, double* %6, i64 %39
%41 = load double, double* %40
%42 = fsub double %37, %41
%43 = tail call double @llvm.fmuladd.f64(double %15, double %42, double %34)
%44 = getelementptr inbounds double, double* %5, i64 %24
store double %43, double* %44
%45 = add nuw nsw i32 %21, 1
%46 = icmp eq i32 %45, %13
br i1 %46, label %47, label %20
47: ; preds = %20, %16
%48 = add nuw nsw i32 %17, 1
%49 = icmp eq i32 %48, %10
br i1 %49, label %50, label %16
50: ; preds = %47, %9
ret i32 1
}