#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 */
long long factorial(int);
long long int combinations(int x, int y) {
  if (x < 0 || y < 0) {
    return -1;
  } else {
    if (x >= y && y >= 0) {
      return ((factorial(x)) / ((factorial(x - y)) * (factorial(y))));
    } else {
      return -1;
    }
  }
}


x86 assembly (clang, -O0):
<combinations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1132 <combinations+0x22>
cmpl   $0x0,-0x10(%rbp)
jge    113f <combinations+0x2f>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    119d <combinations+0x8d>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1195 <combinations+0x85>
cmpl   $0x0,-0x10(%rbp)
jl     1195 <combinations+0x85>
mov    -0xc(%rbp),%edi
call   1030 <factorial@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1030 <factorial@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <factorial@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
imul   %rdx,%rcx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    119d <combinations+0x8d>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<combinations>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0xffffffffffffffff,%rax
sub    %esi,%ebx
jl     1166 <combinations+0x56>
mov    %esi,%ebp
mov    %esi,%ecx
or     %edi,%ecx
js     1166 <combinations+0x56>
call   1030 <factorial@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1030 <factorial@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <factorial@plt>
mov    %rax,%rcx
imul   %rbx,%rcx
mov    %r14,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     115f <combinations+0x4f>
mov    %r14,%rax
cqto
idiv   %rcx
jmp    1166 <combinations+0x56>
mov    %r14d,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i64 @combinations(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp slt i32 %3, 0
%5 = icmp slt i32 %0, %1
%6 = or i1 %5, %4
br i1 %6, label %14, label %7
7: ; preds = %2
%8 = tail call i64 @factorial(i32 %0)
%9 = sub nsw i32 %0, %1
%10 = tail call i64 @factorial(i32 %9)
%11 = tail call i64 @factorial(i32 %1)
%12 = mul nsw i64 %11, %10
%13 = sdiv i64 %8, %12
br label %14
14: ; preds = %2, %7
%15 = phi i64 [ %13, %7 ], [ -1, %2 ]
ret i64 %15
}