#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 atoi(char *);
long long atoll(char *);
int dragon_getCoordN(int *, int *, int, long long);
int /*<<< orphan*/ printf(char *, int, int, ...);
int main(int argc, char **argv) {
  int x = 0, y = 0, ret;
  int order;
  long long nF;
  if (argc != 3)
    return -1;
  order = atoi(argv[1]);
  nF = atoll(argv[2]);
  printf("Search order=%d nF=%lld\n", order, nF);
  ret = dragon_getCoordN(&x, &y, order, nF);
  printf("x=%d y=%d (ret=%d)\n", x, y, ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     117a <main+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e7 <main+0xa7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoll@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%rax
mov    %eax,%edx
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%rcx
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <dragon_getCoordN@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0xffffffff,%ebp
cmp    $0x3,%edi
jne    11bf <main+0x7f>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1050 <atoll@plt>
mov    %rax,%rbx
lea    0xe7c(%rip),%rdi
xor    %ebp,%ebp
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    %r14d,%edx
mov    %rbx,%rcx
call   1030 <dragon_getCoordN@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe63(%rip),%rdi
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Search order=%d nF=%lld\0A\00"
@.str.1 = [20 x i8] c"x=%d y=%d (ret=%d)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %34
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %9
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i64 @atoll(i8* %21)
store i64 %22, i64* %10
%23 = load i32, i32* %9
%24 = load i64, i64* %10
%25 = trunc i64 %24 to i32
%26 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %25)
%27 = load i32, i32* %9
%28 = load i64, i64* %10
%29 = call i32 @dragon_getCoordN(i32* %6, i32* %7, i32 %27, i64 %28)
store i32 %29, i32* %8
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %31, i32 %32)
store i32 0, i32* %3
br label %34
34: ; preds = %14, %13
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str = [25 x i8] c"Search order=%d nF=%lld\0A\00"
@.str.1 = [20 x i8] c"x=%d y=%d (ret=%d)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = icmp eq i32 %0, 3
br i1 %7, label %8, label %21
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i64 @atoll(i8* %13)
%15 = trunc i64 %14 to i32
%16 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %15)
%17 = call i32 @dragon_getCoordN(i32* %3, i32* %4, i32 %11, i64 %14)
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %19, i32 %17)
br label %21
21: ; preds = %2, %8
%22 = phi i32 [ 0, %8 ], [ -1, %2 ]
ret i32 %22
}