#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int f(int, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int deltax, deltay;
  int c;
  if (argc < 3) {
    printf("need 2 positive integers.\n");
    return EXIT_FAILURE;
  }
  deltax = (int)strtol(argv[1], NULL, 10);
  deltay = (int)strtol(argv[2], NULL, 10);
  if ((deltax < 0) || (deltay < 0)) {
    printf("need 2 positive integers.\n");
    return EXIT_FAILURE;
  }
  c = f(deltax, deltay);
  printf("f(%d, %d) = %d.\n", deltax, deltay, c);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    116f <main+0x3f>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1205 <main+0xd5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11b5 <main+0x85>
cmpl   $0x0,-0x18(%rbp)
jge    11d4 <main+0xa4>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1205 <main+0xd5>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <f@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jle    11a3 <main+0x63>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
test   %r14d,%r14d
js     11a3 <main+0x63>
mov    %rax,%rbx
test   %ebx,%ebx
js     11a3 <main+0x63>
mov    %r14d,%edi
mov    %ebx,%esi
call   1040 <f@plt>
lea    0xe74(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e37(%rip),%rax
jmp    11b6 <main+0x76>
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"need 2 positive integers.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [17 x i8] c"f(%d, %d) = %d.\0A\00"
@EXIT_SUCCESS = global i32 0
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
store i32 %13, i32* %3
br label %42
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strtol(i8* %17, i32* null, i32 10)
%19 = trunc i64 %18 to i32
store i32 %19, i32* %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i64 @strtol(i8* %22, i32* null, i32 10)
%24 = trunc i64 %23 to i32
store i32 %24, i32* %7
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %14
%28 = load i32, i32* %7
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27, %14
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
store i32 %32, i32* %3
br label %42
33: ; preds = %27
%34 = load i32, i32* %6
%35 = load i32, i32* %7
%36 = call i32 @f(i32 %34, i32 %35)
store i32 %36, i32* %8
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = load i32, i32* %8
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38, i32 %39)
%41 = load i32, i32* @EXIT_SUCCESS
store i32 %41, i32* %3
br label %42
42: ; preds = %33, %30, %11
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [17 x i8] c"f(%d, %d) = %d.\0A\00"
@EXIT_SUCCESS = global i32 0
@str.2 = [26 x i8] c"need 2 positive integers.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
br label %23
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strtol(i8* nocapture %8, i32* null, i32 10)
%10 = trunc i64 %9 to i32
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i64 @strtol(i8* nocapture %12, i32* null, i32 10)
%14 = trunc i64 %13 to i32
%15 = icmp slt i32 %10, 0
%16 = icmp slt i32 %14, 0
%17 = select i1 %15, i1 true, i1 %16
br i1 %17, label %18, label %20
18: ; preds = %6
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
br label %23
20: ; preds = %6
%21 = tail call i32 @f(i32 %10, i32 %14)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %14, i32 %21)
br label %23
23: ; preds = %20, %18, %4
%24 = phi i32* [ @EXIT_FAILURE, %4 ], [ @EXIT_FAILURE, %18 ], [ @EXIT_SUCCESS, %20 ]
%25 = load i32, i32* %24
ret i32 %25
}