#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_u_exact(int n, double *x, double *y, double **ue) {
  int i, j;
  for (i = 1; i < n; i++) {
    for (j = 1; j < n; j++) {
      ue[i][j] = ue_eval(x[i], y[j]);
    }
  }
}


x86 assembly (clang, -O0):
<set_u_exact>:
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   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a2 <set_u_exact+0x92>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118f <set_u_exact+0x7f>
mov    -0x10(%rbp),%rax
movslq -0x24(%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 -0x24(%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    1141 <set_u_exact+0x31>
jmp    1194 <set_u_exact+0x84>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <set_u_exact+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_u_exact>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     117c <set_u_exact+0x6c>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %edi,%r13d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%r12,%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,%r13
jne    1150 <set_u_exact+0x40>
add    $0x1,%rbx
cmp    %r13,%rbx
jne    1140 <set_u_exact+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @set_u_exact(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 1, i32* %9
br label %11
11: ; preds = %44, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %47
15: ; preds = %11
store i32 1, i32* %10
br label %16
16: ; preds = %40, %15
%17 = load i32, i32* %10
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %43
20: ; preds = %16
%21 = load double*, double** %6
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load double*, double** %7
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = call double @ue_eval(double %25, double %30)
%32 = load double**, double*** %8
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double*, double** %32, i64 %34
%36 = load double*, double** %35
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
store double %31, double* %39
br label %40
40: ; preds = %20
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %16
43: ; preds = %16
br label %44
44: ; preds = %43
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %11
47: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @set_u_exact(i32 %0, double* nocapture %1, double* nocapture %2, double** nocapture %3) {
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %25
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %22, %6
%9 = phi i64 [ 1, %6 ], [ %23, %22 ]
%10 = getelementptr inbounds double, double* %1, i64 %9
%11 = getelementptr inbounds double*, double** %3, i64 %9
br label %12
12: ; preds = %8, %12
%13 = phi i64 [ 1, %8 ], [ %20, %12 ]
%14 = load double, double* %10
%15 = getelementptr inbounds double, double* %2, i64 %13
%16 = load double, double* %15
%17 = tail call double @ue_eval(double %14, double %16)
%18 = load double*, double** %11
%19 = getelementptr inbounds double, double* %18, i64 %13
store double %17, double* %19
%20 = add nuw nsw i64 %13, 1
%21 = icmp eq i64 %20, %7
br i1 %21, label %22, label %12
22: ; preds = %12
%23 = add nuw nsw i64 %9, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %25, label %8
25: ; preds = %22, %4
ret void
}