#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 */
scalar_t__ round(double);
int find_coor(double **coords, int Ngrid, double lat, double lon, double dep) {
  int i;
  for (i = 0; i < Ngrid; i++)
    if ((int)round(coords[i][0] * 10000.) == (int)round(lat * 10000.) &&
        (int)round(coords[i][1] * 10000.) == (int)round(lon * 10000.) &&
        (int)round(coords[i][2] * 10000.) == (int)round(dep * 10000.))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<find_coor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1222 <find_coor+0x112>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0xeab(%rip),%xmm0
mulsd  (%rax),%xmm0
call   1030 <round@plt>
mov    %eax,-0x38(%rbp)
movsd  0xe97(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <round@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jne    120f <find_coor+0xff>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0xe6b(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
call   1030 <round@plt>
mov    %eax,-0x3c(%rbp)
movsd  0xe56(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1030 <round@plt>
mov    %rax,%rcx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jne    120f <find_coor+0xff>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0xe2a(%rip),%xmm0
mulsd  0x10(%rax),%xmm0
call   1030 <round@plt>
mov    %eax,-0x40(%rbp)
movsd  0xe15(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1030 <round@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
jne    120f <find_coor+0xff>
movl   $0x1,-0x4(%rbp)
jmp    1229 <find_coor+0x119>
jmp    1214 <find_coor+0x104>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1135 <find_coor+0x25>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_coor>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %esi,%esi
jle    11f5 <find_coor+0xe5>
mov    %rdi,%r14
movsd  0xed2(%rip),%xmm3
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm3,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm3,%xmm2
movsd  %xmm2,(%rsp)
mov    %esi,%r15d
xor    %ebx,%ebx
jmp    1175 <find_coor+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r15
movsd  0xe91(%rip),%xmm3
je     11f5 <find_coor+0xe5>
mov    (%r14,%rbx,8),%rax
movsd  (%rax),%xmm0
mulsd  %xmm3,%xmm0
call   1030 <round@plt>
mov    %rax,%r12
movsd  0x10(%rsp),%xmm0
call   1030 <round@plt>
cmp    %eax,%r12d
jne    1160 <find_coor+0x50>
mov    (%r14,%rbx,8),%rax
movsd  0x8(%rax),%xmm0
mulsd  0xe56(%rip),%xmm0
call   1030 <round@plt>
mov    %rax,%r12
movsd  0x8(%rsp),%xmm0
call   1030 <round@plt>
cmp    %eax,%r12d
jne    1160 <find_coor+0x50>
mov    (%r14,%rbx,8),%rax
movsd  0x10(%rax),%xmm0
mulsd  0xe2d(%rip),%xmm0
call   1030 <round@plt>
mov    %rax,%r12
movsd  (%rsp),%xmm0
call   1030 <round@plt>
cmp    %eax,%r12d
jne    1160 <find_coor+0x50>
mov    $0x1,%eax
jmp    11f7 <find_coor+0xe7>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @find_coor(double** %0, i32 %1, double %2, double %3, double %4) {
%6 = alloca i32
%7 = alloca double**
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
store double** %0, double*** %7
store i32 %1, i32* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store i32 0, i32* %12
br label %13
13: ; preds = %67, %5
%14 = load i32, i32* %12
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %70
17: ; preds = %13
%18 = load double**, double*** %7
%19 = load i32, i32* %12
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double*, double** %18, i64 %20
%22 = load double*, double** %21
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = fmul double %24, 1.000000e+04
%26 = call i64 @round(double %25)
%27 = trunc i64 %26 to i32
%28 = load double, double* %9
%29 = fmul double %28, 1.000000e+04
%30 = call i64 @round(double %29)
%31 = trunc i64 %30 to i32
%32 = icmp eq i32 %27, %31
br i1 %32, label %33, label %66
33: ; preds = %17
%34 = load double**, double*** %7
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double*, double** %34, i64 %36
%38 = load double*, double** %37
%39 = getelementptr inbounds double, double* %38, i64 1
%40 = load double, double* %39
%41 = fmul double %40, 1.000000e+04
%42 = call i64 @round(double %41)
%43 = trunc i64 %42 to i32
%44 = load double, double* %10
%45 = fmul double %44, 1.000000e+04
%46 = call i64 @round(double %45)
%47 = trunc i64 %46 to i32
%48 = icmp eq i32 %43, %47
br i1 %48, label %49, label %66
49: ; preds = %33
%50 = load double**, double*** %7
%51 = load i32, i32* %12
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double*, double** %50, i64 %52
%54 = load double*, double** %53
%55 = getelementptr inbounds double, double* %54, i64 2
%56 = load double, double* %55
%57 = fmul double %56, 1.000000e+04
%58 = call i64 @round(double %57)
%59 = trunc i64 %58 to i32
%60 = load double, double* %11
%61 = fmul double %60, 1.000000e+04
%62 = call i64 @round(double %61)
%63 = trunc i64 %62 to i32
%64 = icmp eq i32 %59, %63
br i1 %64, label %65, label %66
65: ; preds = %49
store i32 1, i32* %6
br label %71
66: ; preds = %49, %33, %17
br label %67
67: ; preds = %66
%68 = load i32, i32* %12
%69 = add nsw i32 %68, 1
store i32 %69, i32* %12
br label %13
70: ; preds = %13
store i32 0, i32* %6
br label %71
71: ; preds = %70, %65
%72 = load i32, i32* %6
ret i32 %72
}

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