#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 /*<<< orphan*/ ularith_gt_2ul_2ul(unsigned long const, unsigned long const,
                                      unsigned long, unsigned long);
void ularith_sub_2ul_2ul_ge(unsigned long *r1, unsigned long *r2,
                            const unsigned long a1, const unsigned long a2) {
  unsigned long t1 = *r1, t2 = *r2;
  if (!ularith_gt_2ul_2ul(a1, a2, *r1, *r2)) {
    *r1 = t1 - a1;
    *r2 = t2 - a2 - (a1 > t1);
  }
}


x86 assembly (clang, -O0):
<ularith_sub_2ul_2ul_ge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
call   1030 <ularith_gt_2ul_2ul@plt>
cmp    $0x0,%eax
jne    1195 <ularith_sub_2ul_2ul_ge+0x85>
mov    -0x28(%rbp),%rcx
sub    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rcx
sub    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
seta   %al
and    $0x1,%al
movzbl %al,%eax
cltq
sub    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ularith_sub_2ul_2ul_ge>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r13
mov    (%rdi),%rbp
mov    (%rsi),%rbx
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1030 <ularith_gt_2ul_2ul@plt>
test   %eax,%eax
jne    114f <ularith_sub_2ul_2ul_ge+0x3f>
sub    %r12,%rbp
mov    %rbp,0x0(%r13)
sbb    %r14,%rbx
mov    %rbx,(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ularith_sub_2ul_2ul_ge(i64* %0, i64* %1, i64 %2, i64 %3) {
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64* %0, i64** %5
store i64* %1, i64** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%11 = load i64*, i64** %5
%12 = load i64, i64* %11
store i64 %12, i64* %9
%13 = load i64*, i64** %6
%14 = load i64, i64* %13
store i64 %14, i64* %10
%15 = load i64, i64* %7
%16 = load i64, i64* %8
%17 = load i64*, i64** %5
%18 = load i64, i64* %17
%19 = load i64*, i64** %6
%20 = load i64, i64* %19
%21 = call i32 @ularith_gt_2ul_2ul(i64 %15, i64 %16, i64 %18, i64 %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %38, label %23
23: ; preds = %4
%24 = load i64, i64* %9
%25 = load i64, i64* %7
%26 = sub i64 %24, %25
%27 = load i64*, i64** %5
store i64 %26, i64* %27
%28 = load i64, i64* %10
%29 = load i64, i64* %8
%30 = sub i64 %28, %29
%31 = load i64, i64* %7
%32 = load i64, i64* %9
%33 = icmp ugt i64 %31, %32
%34 = zext i1 %33 to i32
%35 = sext i32 %34 to i64
%36 = sub i64 %30, %35
%37 = load i64*, i64** %6
store i64 %36, i64* %37
br label %38
38: ; preds = %23, %4
ret void
}

LLVM IR (-O2):
define void @ularith_sub_2ul_2ul_ge(i64* nocapture %0, i64* nocapture %1, i64 %2, i64 %3) {
%5 = load i64, i64* %0
%6 = load i64, i64* %1
%7 = tail call i32 @ularith_gt_2ul_2ul(i64 %2, i64 %3, i64 %5, i64 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = sub i64 %5, %2
store i64 %10, i64* %0
%11 = sub i64 %6, %3
%12 = icmp ult i64 %5, %2
%13 = sext i1 %12 to i64
%14 = add i64 %11, %13
store i64 %14, i64* %1
br label %15
15: ; preds = %9, %4
ret void
}