#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 Bank_GetBalance(int);
int _GetMinBalance(int);
int _CanTransfer(int Source, int Destination, int Ammount) {
  if (Ammount > 0) {
    if (Bank_GetBalance(Source) - Ammount < _GetMinBalance(Source))
      return 0;
  } else {
    if (Bank_GetBalance(Destination) + Ammount < _GetMinBalance(Destination))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<_CanTransfer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    116f <_CanTransfer+0x4f>
mov    -0x8(%rbp),%edi
call   1040 <Bank_GetBalance@plt>
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <_GetMinBalance@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    116a <_CanTransfer+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    11aa <_CanTransfer+0x8a>
jmp    11a3 <_CanTransfer+0x83>
mov    -0xc(%rbp),%edi
call   1040 <Bank_GetBalance@plt>
add    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <_GetMinBalance@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    119e <_CanTransfer+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11aa <_CanTransfer+0x8a>
jmp    11a3 <_CanTransfer+0x83>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_CanTransfer>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
test   %edx,%edx
jle    113e <_CanTransfer+0x1e>
mov    %edi,%r15d
call   1040 <Bank_GetBalance@plt>
mov    %eax,%ebp
sub    %ebx,%ebp
mov    %r15d,%edi
jmp    114f <_CanTransfer+0x2f>
mov    %esi,%r14d
mov    %esi,%edi
call   1040 <Bank_GetBalance@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r14d,%edi
call   1030 <_GetMinBalance@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%ebp
jl     1161 <_CanTransfer+0x41>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @_CanTransfer(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = tail call i32 @Bank_GetBalance(i32 %0)
%7 = sub nsw i32 %6, %2
%8 = tail call i32 @_GetMinBalance(i32 %0)
%9 = icmp slt i32 %7, %8
br i1 %9, label %16, label %15
10: ; preds = %3
%11 = tail call i32 @Bank_GetBalance(i32 %1)
%12 = add nsw i32 %11, %2
%13 = tail call i32 @_GetMinBalance(i32 %1)
%14 = icmp slt i32 %12, %13
br i1 %14, label %16, label %15
15: ; preds = %10, %5
br label %16
16: ; preds = %10, %5, %15
%17 = phi i32 [ 1, %15 ], [ 0, %5 ], [ 0, %10 ]
ret i32 %17
}