#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ stderr;
void print_walk(int **walk_points, int num_pts, FILE *walk_fp) {
  int i;
  if (num_pts < 1) {
    fprintf(stderr, "print_walk:  num_pts must be >= 1; got %d.\n", num_pts);
    exit(1);
  }
  if (walk_fp == NULL)
    return;
  fprintf(walk_fp, " %2d", num_pts);
  for (i = 0; i < num_pts; i++)
    fprintf(walk_fp, " (%3d,%3d)", walk_points[i][0], walk_points[i][1]);
  fprintf(walk_fp, "\n");
}


x86 assembly (clang, -O0):
<print_walk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    1162 <print_walk+0x42>
mov    0x2e9c(%rip),%rax
movslq (%rax),%rdi
mov    -0xc(%rbp),%edx
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
cmpq   $0x0,-0x18(%rbp)
jne    1172 <print_walk+0x52>
jmp    11e9 <print_walk+0xc9>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d7 <print_walk+0xb7>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%ecx
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118e <print_walk+0x6e>
mov    -0x18(%rbp),%rdi
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_walk>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebp
test   %esi,%esi
jle    11ad <print_walk+0x7d>
mov    %rdx,%r12
test   %rdx,%rdx
je     11a4 <print_walk+0x74>
mov    %rdi,%r14
lea    0xedc(%rip),%rsi
mov    %r12,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebp,%ebp
lea    0xecc(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rax
mov    (%rax),%edx
mov    0x4(%rax),%ecx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <print_walk+0x40>
mov    $0xa,%edi
mov    %r12,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e2c(%rip),%rax
movslq (%rax),%rdi
lea    0xe42(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"print_walk: num_pts must be >= 1; got %d.\0A\00"
@.str.1 = [5 x i8] c" %2d\00"
@.str.2 = [11 x i8] c" (%3d,%3d)\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @print_walk(i32** %0, i32 %1, i32* %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load i32, i32* @stderr
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load i32, i32* %5
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %3
%18 = load i32*, i32** %6
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %21
20: ; preds = %17
br label %52
21: ; preds = %17
%22 = load i32*, i32** %6
%23 = load i32, i32* %5
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %23)
store i32 0, i32* %7
br label %25
25: ; preds = %46, %21
%26 = load i32, i32* %7
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %49
29: ; preds = %25
%30 = load i32*, i32** %6
%31 = load i32**, i32*** %4
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32*, i32** %31, i64 %33
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 0
%37 = load i32, i32* %36
%38 = load i32**, i32*** %4
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32*, i32** %38, i64 %40
%42 = load i32*, i32** %41
%43 = getelementptr inbounds i32, i32* %42, i64 1
%44 = load i32, i32* %43
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %44)
br label %46
46: ; preds = %29
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %25
49: ; preds = %25
%50 = load i32*, i32** %6
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %49, %20
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"print_walk: num_pts must be >= 1; got %d.\0A\00"
@.str.1 = [5 x i8] c" %2d\00"
@.str.2 = [11 x i8] c" (%3d,%3d)\00"
define void @print_walk(i32** nocapture %0, i32 %1, i32* %2) {
%4 = icmp slt i32 %1, 1
br i1 %4, label %5, label %11
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %1)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %3
%12 = icmp eq i32* %2, null
br i1 %12, label %28, label %13
13: ; preds = %11
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%15 = zext i32 %1 to i64
br label %16
16: ; preds = %13, %16
%17 = phi i64 [ 0, %13 ], [ %24, %16 ]
%18 = getelementptr inbounds i32*, i32** %0, i64 %17
%19 = load i32*, i32** %18
%20 = load i32, i32* %19
%21 = getelementptr inbounds i32, i32* %19, i64 1
%22 = load i32, i32* %21
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %22)
%24 = add nuw nsw i64 %17, 1
%25 = icmp eq i64 %24, %15
br i1 %25, label %26, label %16
26: ; preds = %16
%27 = tail call i32 @fputc(i32 10, i32* %2)
br label %28
28: ; preds = %11, %26
ret void
}