#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__ min_time(int *, int *);
int minTimeToVisitAllPoints(int **points, int pointsSize, int *pointsColSize) {
  int time = 0;
  for (int i = 0; i < pointsSize - 1; i++) {
    time += min_time(points[i], points[i + 1]);
  }
  return time;
}


x86 assembly (clang, -O0):
<minTimeToVisitAllPoints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    117f <minTimeToVisitAllPoints+0x6f>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <min_time@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1131 <minTimeToVisitAllPoints+0x21>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minTimeToVisitAllPoints>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebp,%ebp
cmp    $0x2,%esi
jl     114c <minTimeToVisitAllPoints+0x3c>
mov    %esi,%r14d
mov    %rdi,%r15
add    $0xffffffff,%r14d
xor    %eax,%eax
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    0x1(%rax),%rbx
mov    (%r15,%rax,8),%rdi
mov    0x8(%r15,%rax,8),%rsi
call   1030 <min_time@plt>
add    %eax,%ebp
mov    %rbx,%rax
cmp    %rbx,%r14
jne    1130 <minTimeToVisitAllPoints+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @minTimeToVisitAllPoints(i32** %0, i32 %1, i32* %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %31, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %34
14: ; preds = %9
%15 = load i32**, i32*** %4
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32*, i32** %15, i64 %17
%19 = load i32*, i32** %18
%20 = load i32**, i32*** %4
%21 = load i32, i32* %8
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32*, i32** %20, i64 %23
%25 = load i32*, i32** %24
%26 = call i64 @min_time(i32* %19, i32* %25)
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = add nsw i64 %28, %26
%30 = trunc i64 %29 to i32
store i32 %30, i32* %7
br label %31
31: ; preds = %14
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %9
34: ; preds = %9
%35 = load i32, i32* %7
ret i32 %35
}

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