#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 DBL_MAX;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int scanf(char *, ...);
int /*<<< orphan*/ stderr;
void initialize(double **F, double **U, int ni, int nj) {
  for (int i = 0; i < ni + 2; i++) {
    for (int j = 0; j < nj + 2; j++) {
      if (scanf("%lf", &F[i][j]) != 1) {
        fprintf(stderr, "invalid input (F)\n");
        exit(1);
      }
      U[i][j] = DBL_MAX;
    }
  }
  int i, j;
  while (1) {
    int sr = scanf("%d %d", &i, &j);
    if (i < 0)
      break;
    if (sr != 2) {
      fprintf(stderr, "invalid input (U)\n");
      exit(1);
    }
    U[i][j] = 0.0;
  }
}


x86 assembly (clang, -O0):
<initialize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    1204 <initialize+0xd4>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    11f1 <initialize+0xc1>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     11c3 <initialize+0x93>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    0x2e0e(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1165 <initialize+0x35>
jmp    11f6 <initialize+0xc6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114d <initialize+0x1d>
jmp    1209 <initialize+0xd9>
lea    0xe07(%rip),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1231 <initialize+0x101>
jmp    1277 <initialize+0x147>
cmpl   $0x2,-0x2c(%rbp)
je     125a <initialize+0x12a>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    0xdd2(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1209 <initialize+0xd9>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %rsi,%r12
mov    %rdx,0x8(%rsp)
cmp    $0xffffffff,%edx
jl     11d8 <initialize+0xa8>
mov    %rdi,%rbx
mov    0x10(%rsp),%rax
lea    0x2(%rax),%ebp
mov    0x8(%rsp),%rax
add    $0x2,%eax
mov    %rax,0x8(%rsp)
shl    $0x3,%rbp
mov    0x2e61(%rip),%r14
xor    %r15d,%r15d
jmp    118b <initialize+0x5b>
nopl   0x0(%rax)
add    $0x1,%r15
cmp    0x8(%rsp),%r15
je     11d8 <initialize+0xa8>
cmpl   $0xffffffff,0x10(%rsp)
jl     1180 <initialize+0x50>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx,%r15,8),%rsi
add    %r13,%rsi
lea    0xe52(%rip),%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    124e <initialize+0x11e>
movsd  (%r14),%xmm0
mov    (%r12,%r15,8),%rax
movsd  %xmm0,(%rax,%r13,1)
add    $0x8,%r13
cmp    %r13,%rbp
jne    11a0 <initialize+0x70>
jmp    1180 <initialize+0x50>
lea    0xe38(%rip),%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rsp),%ecx
test   %ecx,%ecx
js     123f <initialize+0x10f>
lea    0xe1b(%rip),%r14
mov    %rsp,%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x2,%eax
jne    126d <initialize+0x13d>
mov    %ecx,%eax
mov    (%r12,%rax,8),%rax
movslq 0x4(%rsp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rsp),%ecx
test   %ecx,%ecx
jns    1210 <initialize+0xe0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
lea    0xda6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
lea    0xda0(%rip),%rsi
jmp    125e <initialize+0x12e>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"invalid input (F)\0A\00"
@DBL_MAX = global double 0.000000e+00
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [19 x i8] c"invalid input (U)\0A\00"
define void @initialize(double** %0, double** %1, i32 %2, i32 %3) {
%5 = alloca double**
%6 = alloca double**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store double** %0, double*** %5
store double** %1, double*** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %14
14: ; preds = %54, %4
%15 = load i32, i32* %9
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 2
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %57
19: ; preds = %14
store i32 0, i32* %10
br label %20
20: ; preds = %50, %19
%21 = load i32, i32* %10
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 2
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %53
25: ; preds = %20
%26 = load double**, double*** %5
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double*, double** %26, i64 %28
%30 = load double*, double** %29
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %33)
%35 = icmp ne i32 %34, 1
br i1 %35, label %36, label %40
36: ; preds = %25
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %25
%41 = load double, double* @DBL_MAX
%42 = load double**, double*** %6
%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* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
store double %41, double* %49
br label %50
50: ; preds = %40
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
store i32 %52, i32* %10
br label %20
53: ; preds = %20
br label %54
54: ; preds = %53
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %14
57: ; preds = %14
br label %58
58: ; preds = %57, %70
%59 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %11, i32* %12)
store i32 %59, i32* %13
%60 = load i32, i32* %11
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %58
br label %79
63: ; preds = %58
%64 = load i32, i32* %13
%65 = icmp ne i32 %64, 2
br i1 %65, label %66, label %70
66: ; preds = %63
%67 = load i32, i32* @stderr
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %63
%71 = load double**, double*** %6
%72 = load i32, i32* %11
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double*, double** %71, i64 %73
%75 = load double*, double** %74
%76 = load i32, i32* %12
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
store double 0.000000e+00, double* %78
br label %58
79: ; preds = %62
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"invalid input (F)\0A\00"
@DBL_MAX = global double 0.000000e+00
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [19 x i8] c"invalid input (U)\0A\00"
define void @initialize(double** nocapture %0, double** nocapture %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = icmp sgt i32 %2, -2
br i1 %7, label %8, label %19
8: ; preds = %4
%9 = icmp sgt i32 %3, -2
%10 = add i32 %3, 2
%11 = add i32 %2, 2
%12 = zext i32 %11 to i64
%13 = zext i32 %10 to i64
br label %14
14: ; preds = %8, %25
%15 = phi i64 [ 0, %8 ], [ %26, %25 ]
br i1 %9, label %16, label %25
16: ; preds = %14
%17 = getelementptr inbounds double*, double** %0, i64 %15
%18 = getelementptr inbounds double*, double** %1, i64 %15
br label %28
19: ; preds = %25, %4
%20 = bitcast i32* %5 to i8*
%21 = bitcast i32* %6 to i8*
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6)
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 0
br i1 %24, label %62, label %44
25: ; preds = %38, %14
%26 = add nuw nsw i64 %15, 1
%27 = icmp eq i64 %26, %12
br i1 %27, label %19, label %14
28: ; preds = %16, %38
%29 = phi i64 [ 0, %16 ], [ %42, %38 ]
%30 = load double*, double** %17
%31 = getelementptr inbounds double, double* %30, i64 %29
%32 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %31)
%33 = icmp eq i32 %32, 1
br i1 %33, label %38, label %34
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%37 = tail call i32 @exit(i32 1)
unreachable
38: ; preds = %28
%39 = load double, double* @DBL_MAX
%40 = load double*, double** %18
%41 = getelementptr inbounds double, double* %40, i64 %29
store double %39, double* %41
%42 = add nuw nsw i64 %29, 1
%43 = icmp eq i64 %42, %13
br i1 %43, label %25, label %28
44: ; preds = %19, %52
%45 = phi i32 [ %60, %52 ], [ %23, %19 ]
%46 = phi i32 [ %59, %52 ], [ %22, %19 ]
%47 = icmp eq i32 %46, 2
br i1 %47, label %52, label %48
48: ; preds = %44
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %44
%53 = zext i32 %45 to i64
%54 = getelementptr inbounds double*, double** %1, i64 %53
%55 = load double*, double** %54
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %55, i64 %57
store double 0.000000e+00, double* %58
%59 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6)
%60 = load i32, i32* %5
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %44
62: ; preds = %52, %19
ret void
}