#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 */
double ue_eval(double, double);
void set_dirichlet_bound(int n, double *x, double *y, double **u) {
  int i, j;
  for (i = 0; i <= n; i++) {
    u[i][0] = ue_eval(x[i], y[0]);
    u[i][n] = ue_eval(x[i], y[n]);
  }
  for (j = 0; j <= n; j++) {
    u[0][j] = ue_eval(x[0], y[j]);
    u[n][j] = ue_eval(x[n], y[j]);
  }
}


x86 assembly (clang, -O0):
<set_dirichlet_bound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11a6 <set_dirichlet_bound+0x96>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <ue_eval@plt>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <ue_eval@plt>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <set_dirichlet_bound+0x1e>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1225 <set_dirichlet_bound+0x115>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <ue_eval@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <ue_eval@plt>
mov    -0x20(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ad <set_dirichlet_bound+0x9d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_dirichlet_bound>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
js     11cd <set_dirichlet_bound+0xbd>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r13
mov    %edi,%ebx
mov    %rdi,(%rsp)
lea    0x1(%rdi),%ebp
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
movsd  0x0(%r13,%r12,8),%xmm0
movsd  (%r15),%xmm1
call   1030 <ue_eval@plt>
mov    (%r14,%r12,8),%rax
movsd  %xmm0,(%rax)
movsd  0x0(%r13,%r12,8),%xmm0
movsd  (%r15,%rbx,8),%xmm1
call   1030 <ue_eval@plt>
mov    (%r14,%r12,8),%rax
movsd  %xmm0,(%rax,%rbx,8)
add    $0x1,%r12
cmp    %r12,%rbp
jne    1140 <set_dirichlet_bound+0x30>
cmpl   $0x0,(%rsp)
js     11cd <set_dirichlet_bound+0xbd>
mov    %rbp,%r12
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsd  0x0(%r13),%xmm0
movsd  (%r15,%rbp,8),%xmm1
call   1030 <ue_eval@plt>
mov    (%r14),%rax
movsd  %xmm0,(%rax,%rbp,8)
movsd  0x0(%r13,%rbx,8),%xmm0
movsd  (%r15,%rbp,8),%xmm1
call   1030 <ue_eval@plt>
mov    (%r14,%rbx,8),%rax
movsd  %xmm0,(%rax,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1190 <set_dirichlet_bound+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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