#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 abs(int);
int /*<<< orphan*/ assert(int);
int subus(int, int);
void proof_uint() {
  for (int a = 0; a < 256; a++) {
    for (int b = 0; b < 256; b++) {
      const int expected = abs(a - b);
      const int result = subus(a, b) | subus(b, a);
      assert(result == expected);
    }
  }
}


x86 assembly (clang, -O0):
<proof_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    11c5 <proof_uint+0x95>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    11b2 <proof_uint+0x82>
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <subus@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1050 <subus@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <proof_uint+0x23>
jmp    11b7 <proof_uint+0x87>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <proof_uint+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proof_uint>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    %r14d,%r12d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12d,%ebx
neg    %ebx
cmovs  %r12d,%ebx
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <subus@plt>
mov    %eax,%r15d
mov    %ebp,%edi
mov    %r14d,%esi
call   1040 <subus@plt>
or     %r15d,%eax
xor    %edi,%edi
cmp    %ebx,%eax
sete   %dil
call   1030 <assert@plt>
add    $0x1,%ebp
add    $0xffffffff,%r12d
cmp    $0x100,%ebp
jne    1140 <proof_uint+0x20>
add    $0x1,%r14d
cmp    $0x100,%r14d
jne    1130 <proof_uint+0x10>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @proof_uint() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %33, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 256
br i1 %7, label %8, label %36
8: ; preds = %5
store i32 0, i32* %2
br label %9
9: ; preds = %29, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 256
br i1 %11, label %12, label %32
12: ; preds = %9
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = sub nsw i32 %13, %14
%16 = call i32 @abs(i32 %15)
store i32 %16, i32* %3
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @subus(i32 %17, i32 %18)
%20 = load i32, i32* %2
%21 = load i32, i32* %1
%22 = call i32 @subus(i32 %20, i32 %21)
%23 = or i32 %19, %22
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = icmp eq i32 %24, %25
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
br label %29
29: ; preds = %12
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %9
32: ; preds = %9
br label %33
33: ; preds = %32
%34 = load i32, i32* %1
%35 = add nsw i32 %34, 1
store i32 %35, i32* %1
br label %5
36: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @proof_uint() {
br label %1
1: ; preds = %0, %4
%2 = phi i32 [ 0, %0 ], [ %5, %4 ]
br label %7
3: ; preds = %4
ret void
4: ; preds = %7
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 256
br i1 %6, label %3, label %1
7: ; preds = %1, %7
%8 = phi i32 [ 0, %1 ], [ %17, %7 ]
%9 = sub nsw i32 %2, %8
%10 = tail call i32 @llvm.abs.i32(i32 %9, i1 true)
%11 = tail call i32 @subus(i32 %2, i32 %8)
%12 = tail call i32 @subus(i32 %8, i32 %2)
%13 = or i32 %12, %11
%14 = icmp eq i32 %13, %10
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = add nuw nsw i32 %8, 1
%18 = icmp eq i32 %17, 256
br i1 %18, label %4, label %7
}