#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 */
int /*<<< orphan*/ INT_MAX;
int /*<<< orphan*/ INT_MIN;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int assignPointNumbers(int begin, int end, const double *zlist, int n,
                       const double *zcorn, const int *actnum, int *plist,
                       double tolerance) {
  int i, k;
  const double *z = zcorn;
  const int *a = actnum;
  int *p = plist;
  k = begin;
  *p++ = INT_MIN;
  for (i = 0; i < n; ++i) {
    if (!a[i / 2]) {
      p[0] = p[-1];
      ++p;
      continue;
    }
    while ((k < end) && (zlist[k] + tolerance < z[i])) {
      k++;
    }
    if ((k == end) || (zlist[k] + tolerance < z[i])) {
      fprintf(stderr, "Cannot associate  zcorn values with given list\n");
      fprintf(stderr, "of z-coordinates to given tolerance\n");
      return 0;
    }
    *p++ = k;
  }
  *p++ = INT_MAX;
  return 1;
}


x86 assembly (clang, -O0):
<assignPointNumbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%ecx
mov    -0x58(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x58(%rbp)
mov    %ecx,(%rax)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12af <assignPointNumbers+0x19f>
mov    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11c5 <assignPointNumbers+0xb5>
mov    -0x58(%rbp),%rax
mov    -0x4(%rax),%ecx
mov    -0x58(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
jmp    12a1 <assignPointNumbers+0x191>
jmp    11ca <assignPointNumbers+0xba>
mov    -0x40(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x61(%rbp)
jge    1204 <assignPointNumbers+0xf4>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  -0x38(%rbp),%xmm1
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    1214 <assignPointNumbers+0x104>
jmp    1222 <assignPointNumbers+0x112>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11ca <assignPointNumbers+0xba>
mov    -0x40(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1257 <assignPointNumbers+0x147>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  -0x38(%rbp),%xmm1
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    128d <assignPointNumbers+0x17d>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xd99(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
lea    0xdb4(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d0 <assignPointNumbers+0x1c0>
mov    -0x40(%rbp),%ecx
mov    -0x58(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x58(%rbp)
mov    %ecx,(%rax)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1175 <assignPointNumbers+0x65>
mov    0x2d32(%rip),%rax
mov    (%rax),%ecx
mov    -0x58(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x58(%rbp)
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assignPointNumbers>:
push   %r15
push   %r14
push   %rbx
mov    0x20(%rsp),%r14
mov    0x2ebf(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,(%r14)
add    $0x4,%r14
test   %ecx,%ecx
jle    11e3 <assignPointNumbers+0xd3>
movslq %esi,%r10
mov    %ecx,%r11d
xor    %r15d,%r15d
jmp    1154 <assignPointNumbers+0x44>
nopl   (%rax)
mov    %ebx,(%r14)
add    $0x1,%r15
add    $0x4,%r14
cmp    %r11,%r15
je     11e3 <assignPointNumbers+0xd3>
mov    %r15d,%eax
and    $0xfffffffe,%eax
cmpl   $0x0,(%r9,%rax,2)
je     1140 <assignPointNumbers+0x30>
cmp    %esi,%edi
jge    119c <assignPointNumbers+0x8c>
movsd  (%r8,%r15,8),%xmm1
movslq %edi,%rax
lea    (%rdx,%rax,8),%rbx
mov    %r10,%rcx
sub    %rax,%rcx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm2
addsd  %xmm0,%xmm2
ucomisd %xmm2,%xmm1
jbe    119a <assignPointNumbers+0x8a>
add    $0x1,%rax
cmp    %rax,%rcx
jne    1180 <assignPointNumbers+0x70>
jmp    11bc <assignPointNumbers+0xac>
add    %eax,%edi
mov    %edi,%ebx
cmp    %esi,%edi
je     11bc <assignPointNumbers+0xac>
movslq %ebx,%rax
movsd  (%rdx,%rax,8),%xmm1
addsd  %xmm0,%xmm1
movsd  (%r8,%r15,8),%xmm2
ucomisd %xmm1,%xmm2
mov    %ebx,%edi
jbe    1140 <assignPointNumbers+0x30>
mov    0x2e0d(%rip),%rbx
mov    (%rbx),%edi
lea    0xe34(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe56(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
jmp    11f4 <assignPointNumbers+0xe4>
mov    0x2dfe(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%r14)
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
@stderr = global i32 0
@.str = [48 x i8] c"Cannot associate zcorn values with given list\0A\00"
@.str.1 = [37 x i8] c"of z-coordinates to given tolerance\0A\00"
@INT_MAX = global i32 0
define i32 @assignPointNumbers(i32 %0, i32 %1, double* %2, i32 %3, double* %4, i32* %5, i32* %6, double %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca i32
%14 = alloca double*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
%20 = alloca double*
%21 = alloca i32*
%22 = alloca i32*
store i32 %0, i32* %10
store i32 %1, i32* %11
store double* %2, double** %12
store i32 %3, i32* %13
store double* %4, double** %14
store i32* %5, i32** %15
store i32* %6, i32** %16
store double %7, double* %17
%23 = load double*, double** %14
store double* %23, double** %20
%24 = load i32*, i32** %15
store i32* %24, i32** %21
%25 = load i32*, i32** %16
store i32* %25, i32** %22
%26 = load i32, i32* %10
store i32 %26, i32* %19
%27 = load i32, i32* @INT_MIN
%28 = load i32*, i32** %22
%29 = getelementptr inbounds i32, i32* %28, i32 1
store i32* %29, i32** %22
store i32 %27, i32* %28
store i32 0, i32* %18
br label %30
30: ; preds = %101, %8
%31 = load i32, i32* %18
%32 = load i32, i32* %13
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %104
34: ; preds = %30
%35 = load i32*, i32** %21
%36 = load i32, i32* %18
%37 = sdiv i32 %36, 2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %35, i64 %38
%40 = load i32, i32* %39
%41 = icmp ne i32 %40, 0
br i1 %41, label %50, label %42
42: ; preds = %34
%43 = load i32*, i32** %22
%44 = getelementptr inbounds i32, i32* %43, i64 -1
%45 = load i32, i32* %44
%46 = load i32*, i32** %22
%47 = getelementptr inbounds i32, i32* %46, i64 0
store i32 %45, i32* %47
%48 = load i32*, i32** %22
%49 = getelementptr inbounds i32, i32* %48, i32 1
store i32* %49, i32** %22
br label %101
50: ; preds = %34
br label %51
51: ; preds = %71, %50
%52 = load i32, i32* %19
%53 = load i32, i32* %11
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %69
55: ; preds = %51
%56 = load double*, double** %12
%57 = load i32, i32* %19
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = load double, double* %17
%62 = fadd double %60, %61
%63 = load double*, double** %20
%64 = load i32, i32* %18
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
%67 = load double, double* %66
%68 = fcmp olt double %62, %67
br label %69
69: ; preds = %55, %51
%70 = phi i1 [ false, %51 ], [ %68, %55 ]
br i1 %70, label %71, label %74
71: ; preds = %69
%72 = load i32, i32* %19
%73 = add nsw i32 %72, 1
store i32 %73, i32* %19
br label %51
74: ; preds = %69
%75 = load i32, i32* %19
%76 = load i32, i32* %11
%77 = icmp eq i32 %75, %76
br i1 %77, label %92, label %78
78: ; preds = %74
%79 = load double*, double** %12
%80 = load i32, i32* %19
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
%84 = load double, double* %17
%85 = fadd double %83, %84
%86 = load double*, double** %20
%87 = load i32, i32* %18
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %86, i64 %88
%90 = load double, double* %89
%91 = fcmp olt double %85, %90
br i1 %91, label %92, label %97
92: ; preds = %78, %74
%93 = load i32, i32* @stderr
%94 = call i32 @fprintf(i32 %93, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%95 = load i32, i32* @stderr
%96 = call i32 @fprintf(i32 %95, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %9
br label %108
97: ; preds = %78
%98 = load i32, i32* %19
%99 = load i32*, i32** %22
%100 = getelementptr inbounds i32, i32* %99, i32 1
store i32* %100, i32** %22
store i32 %98, i32* %99
br label %101
101: ; preds = %97, %42
%102 = load i32, i32* %18
%103 = add nsw i32 %102, 1
store i32 %103, i32* %18
br label %30
104: ; preds = %30
%105 = load i32, i32* @INT_MAX
%106 = load i32*, i32** %22
%107 = getelementptr inbounds i32, i32* %106, i32 1
store i32* %107, i32** %22
store i32 %105, i32* %106
store i32 1, i32* %9
br label %108
108: ; preds = %104, %92
%109 = load i32, i32* %9
ret i32 %109
}

LLVM IR (-O2):
@INT_MIN = global i32 0
@stderr = global i32 0
@.str = [48 x i8] c"Cannot associate zcorn values with given list\0A\00"
@.str.1 = [37 x i8] c"of z-coordinates to given tolerance\0A\00"
@INT_MAX = global i32 0
define i32 @assignPointNumbers(i32 %0, i32 %1, double* nocapture %2, i32 %3, double* nocapture %4, i32* nocapture %5, i32* nocapture %6, double %7) {
%9 = load i32, i32* @INT_MIN
store i32 %9, i32* %6
%10 = getelementptr inbounds i32, i32* %6, i64 1
%11 = icmp sgt i32 %3, 0
br i1 %11, label %12, label %64
12: ; preds = %8
%13 = sext i32 %1 to i64
%14 = zext i32 %3 to i64
br label %15
15: ; preds = %12, %58
%16 = phi i32 [ %9, %12 ], [ %59, %58 ]
%17 = phi i64 [ 0, %12 ], [ %61, %58 ]
%18 = phi i32* [ %10, %12 ], [ %62, %58 ]
%19 = phi i32 [ %0, %12 ], [ %60, %58 ]
%20 = lshr i64 %17, 1
%21 = and i64 %20, 2147483647
%22 = getelementptr inbounds i32, i32* %5, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %58, label %25
25: ; preds = %15
%26 = icmp slt i32 %19, %1
br i1 %26, label %27, label %42
27: ; preds = %25
%28 = getelementptr inbounds double, double* %4, i64 %17
%29 = load double, double* %28
%30 = sext i32 %19 to i64
br label %31
31: ; preds = %27, %37
%32 = phi i64 [ %30, %27 ], [ %38, %37 ]
%33 = getelementptr inbounds double, double* %2, i64 %32
%34 = load double, double* %33
%35 = fadd double %34, %7
%36 = fcmp olt double %35, %29
br i1 %36, label %37, label %40
37: ; preds = %31
%38 = add nsw i64 %32, 1
%39 = icmp eq i64 %38, %13
br i1 %39, label %53, label %31
40: ; preds = %31
%41 = trunc i64 %32 to i32
br label %42
42: ; preds = %40, %25
%43 = phi i32 [ %19, %25 ], [ %41, %40 ]
%44 = icmp eq i32 %43, %1
br i1 %44, label %53, label %45
45: ; preds = %42
%46 = sext i32 %43 to i64
%47 = getelementptr inbounds double, double* %2, i64 %46
%48 = load double, double* %47
%49 = fadd double %48, %7
%50 = getelementptr inbounds double, double* %4, i64 %17
%51 = load double, double* %50
%52 = fcmp olt double %49, %51
br i1 %52, label %53, label %58
53: ; preds = %45, %42, %37
%54 = load i32, i32* @stderr
%55 = tail call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%56 = load i32, i32* @stderr
%57 = tail call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %67
58: ; preds = %15, %45
%59 = phi i32 [ %43, %45 ], [ %16, %15 ]
%60 = phi i32 [ %43, %45 ], [ %19, %15 ]
store i32 %59, i32* %18
%61 = add nuw nsw i64 %17, 1
%62 = getelementptr inbounds i32, i32* %18, i64 1
%63 = icmp eq i64 %61, %14
br i1 %63, label %64, label %15
64: ; preds = %58, %8
%65 = phi i32* [ %10, %8 ], [ %62, %58 ]
%66 = load i32, i32* @INT_MAX
store i32 %66, i32* %65
br label %67
67: ; preds = %64, %53
%68 = phi i32 [ 0, %53 ], [ 1, %64 ]
ret i32 %68
}