#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, unsigned int);
int calcH(int k, int skip, unsigned int sx, unsigned int sy, double CH,
          double *Ez, double *Hx, double *Hy, double *oldHx, double *oldHy) {
  int t, x, y, in;
  for (y = 0; y < sy - 1; y++)
    for (x = 0; x < sx - 1; x++) {
      in = I(x, y, sx);
      Hy[in] = CH * (Ez[I(x, y + 1, sx)] - Ez[I(x, y, sx)]);
      Hx[in] = -CH * (Ez[I(x + 1, y, sx)] - Ez[I(x, y, sx)]);
      if (k > 0) {
        Hy[in] += oldHy[in];
        Hx[in] += oldHx[in];
      }
    }
  return 1;
}


x86 assembly (clang, -O0):
<calcH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jae    12e8 <calcH+0x1d8>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jae    12d5 <calcH+0x1c5>
mov    -0x30(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <I@plt>
mov    %eax,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x34(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
call   1030 <I@plt>
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <I@plt>
movsd  -0x70(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
subsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%edi
add    $0x1,%edi
mov    -0x34(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <I@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <I@plt>
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
subsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
cmpl   $0x0,-0x4(%rbp)
jle    12c2 <calcH+0x1b2>
mov    0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    12c7 <calcH+0x1b7>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    115f <calcH+0x4f>
jmp    12da <calcH+0x1ca>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1147 <calcH+0x37>
mov    $0x1,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcH>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r8,0x28(%rsp)
movapd %xmm0,0x30(%rsp)
mov    %edi,0x1c(%rsp)
add    $0xffffffff,%ecx
mov    %ecx,0x18(%rsp)
je     1297 <calcH+0x187>
mov    %edx,%ebp
lea    -0x1(%rbp),%eax
mov    %eax,0x8(%rsp)
movapd 0xeb5(%rip),%xmm0
xorpd  0x30(%rsp),%xmm0
movapd %xmm0,0x40(%rsp)
xor    %r14d,%r14d
mov    %r9,0x20(%rsp)
mov    0x28(%rsp),%r13
jmp    1181 <calcH+0x71>
cs nopw 0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
mov    %eax,%r14d
cmp    0x18(%rsp),%eax
je     1297 <calcH+0x187>
lea    0x1(%r14),%eax
mov    %eax,0xc(%rsp)
cmpl   $0x0,0x8(%rsp)
je     1170 <calcH+0x60>
xor    %r15d,%r15d
jmp    11a7 <calcH+0x97>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    0x8(%rsp),%r15d
je     1170 <calcH+0x60>
mov    %r15d,%r12d
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <I@plt>
mov    %rax,%rbx
mov    %r15d,%edi
mov    0xc(%rsp),%esi
mov    %ebp,%edx
call   1030 <I@plt>
movsd  0x0(%r13,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <I@plt>
movsd  0x10(%rsp),%xmm0
subsd  0x0(%r13,%rax,8),%xmm0
mulsd  0x30(%rsp),%xmm0
movslq %ebx,%rbx
mov    0x90(%rsp),%rax
movsd  %xmm0,(%rax,%rbx,8)
lea    0x1(%r12),%r15d
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <I@plt>
movsd  0x0(%r13,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r12d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
call   1030 <I@plt>
mov    0x20(%rsp),%r9
movsd  0x10(%rsp),%xmm0
subsd  0x0(%r13,%rax,8),%xmm0
mulsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%r9,%rbx,8)
cmpl   $0x0,0x1c(%rsp)
jle    11a0 <calcH+0x90>
mov    0xa0(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm0
mov    0x90(%rsp),%rax
addsd  (%rax,%rbx,8),%xmm0
movsd  %xmm0,(%rax,%rbx,8)
mov    0x98(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm0
addsd  (%r9,%rbx,8),%xmm0
movsd  %xmm0,(%r9,%rbx,8)
jmp    11a0 <calcH+0x90>
mov    $0x1,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @calcH(i32 %0, i32 %1, i32 %2, i32 %3, double %4, double* %5, double* %6, double* %7, double* %8, double* %9) {
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32 %0, i32* %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store double %4, double* %15
store double* %5, double** %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
store double* %9, double** %20
store i32 0, i32* %23
br label %25
25: ; preds = %117, %10
%26 = load i32, i32* %23
%27 = load i32, i32* %14
%28 = sub i32 %27, 1
%29 = icmp ult i32 %26, %28
br i1 %29, label %30, label %120
30: ; preds = %25
store i32 0, i32* %22
br label %31
31: ; preds = %113, %30
%32 = load i32, i32* %22
%33 = load i32, i32* %13
%34 = sub i32 %33, 1
%35 = icmp ult i32 %32, %34
br i1 %35, label %36, label %116
36: ; preds = %31
%37 = load i32, i32* %22
%38 = load i32, i32* %23
%39 = load i32, i32* %13
%40 = call i64 @I(i32 %37, i32 %38, i32 %39)
%41 = trunc i64 %40 to i32
store i32 %41, i32* %24
%42 = load double, double* %15
%43 = load double*, double** %16
%44 = load i32, i32* %22
%45 = load i32, i32* %23
%46 = add nsw i32 %45, 1
%47 = load i32, i32* %13
%48 = call i64 @I(i32 %44, i32 %46, i32 %47)
%49 = getelementptr inbounds double, double* %43, i64 %48
%50 = load double, double* %49
%51 = load double*, double** %16
%52 = load i32, i32* %22
%53 = load i32, i32* %23
%54 = load i32, i32* %13
%55 = call i64 @I(i32 %52, i32 %53, i32 %54)
%56 = getelementptr inbounds double, double* %51, i64 %55
%57 = load double, double* %56
%58 = fsub double %50, %57
%59 = fmul double %42, %58
%60 = load double*, double** %18
%61 = load i32, i32* %24
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
store double %59, double* %63
%64 = load double, double* %15
%65 = fneg double %64
%66 = load double*, double** %16
%67 = load i32, i32* %22
%68 = add nsw i32 %67, 1
%69 = load i32, i32* %23
%70 = load i32, i32* %13
%71 = call i64 @I(i32 %68, i32 %69, i32 %70)
%72 = getelementptr inbounds double, double* %66, i64 %71
%73 = load double, double* %72
%74 = load double*, double** %16
%75 = load i32, i32* %22
%76 = load i32, i32* %23
%77 = load i32, i32* %13
%78 = call i64 @I(i32 %75, i32 %76, i32 %77)
%79 = getelementptr inbounds double, double* %74, i64 %78
%80 = load double, double* %79
%81 = fsub double %73, %80
%82 = fmul double %65, %81
%83 = load double*, double** %17
%84 = load i32, i32* %24
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %83, i64 %85
store double %82, double* %86
%87 = load i32, i32* %11
%88 = icmp sgt i32 %87, 0
br i1 %88, label %89, label %112
89: ; preds = %36
%90 = load double*, double** %20
%91 = load i32, i32* %24
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
%94 = load double, double* %93
%95 = load double*, double** %18
%96 = load i32, i32* %24
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %95, i64 %97
%99 = load double, double* %98
%100 = fadd double %99, %94
store double %100, double* %98
%101 = load double*, double** %19
%102 = load i32, i32* %24
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %101, i64 %103
%105 = load double, double* %104
%106 = load double*, double** %17
%107 = load i32, i32* %24
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = fadd double %110, %105
store double %111, double* %109
br label %112
112: ; preds = %89, %36
br label %113
113: ; preds = %112
%114 = load i32, i32* %22
%115 = add nsw i32 %114, 1
store i32 %115, i32* %22
br label %31
116: ; preds = %31
br label %117
117: ; preds = %116
%118 = load i32, i32* %23
%119 = add nsw i32 %118, 1
store i32 %119, i32* %23
br label %25
120: ; preds = %25
ret i32 1
}

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