#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 fail_real(int /*<<< orphan*/, int);
int sub_i16(int, int);
int sub_i32(int, int);
int sub_i64(int, int);
int sub_i8(int, int);
int test_sub(void) {
  if (sub_i8(-1, 1) != -2)
    return fail_real(0, 181);
  if (sub_i8(1, -1) != 2)
    return fail_real(0, 183);
  if (sub_i8(1, 1) != 0)
    return fail_real(0, 185);
  if (sub_i16(-1, 1) != -2)
    return fail_real(0, 188);
  if (sub_i16(1, -1) != 2)
    return fail_real(0, 190);
  if (sub_i16(1, 1) != 0)
    return fail_real(0, 192);
  if (sub_i32(-1, 1) != -2)
    return fail_real(0, 195);
  if (sub_i32(1, -1) != 2)
    return fail_real(0, 197);
  if (sub_i32(1, 1) != 0)
    return fail_real(0, 199);
  if (sub_i64(-1, 1) != -2)
    return fail_real(0, 202);
  if (sub_i64(1, -1) != 2)
    return fail_real(0, 204);
  if (sub_i64(1, 1) != 0)
    return fail_real(0, 206);
  return 4;
}


x86 assembly (clang, -O0):
<test_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1070 <sub_i8@plt>
cmp    $0xfffffffe,%eax
je     1184 <test_sub+0x34>
xor    %edi,%edi
mov    $0xb5,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1070 <sub_i8@plt>
cmp    $0x2,%eax
je     11b0 <test_sub+0x60>
xor    %edi,%edi
mov    $0xb7,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0x1,%esi
mov    %esi,%edi
call   1070 <sub_i8@plt>
cmp    $0x0,%eax
je     11d9 <test_sub+0x89>
xor    %edi,%edi
mov    $0xb9,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1030 <sub_i16@plt>
cmp    $0xfffffffe,%eax
je     1205 <test_sub+0xb5>
xor    %edi,%edi
mov    $0xbc,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1030 <sub_i16@plt>
cmp    $0x2,%eax
je     1231 <test_sub+0xe1>
xor    %edi,%edi
mov    $0xbe,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <sub_i16@plt>
cmp    $0x0,%eax
je     125a <test_sub+0x10a>
xor    %edi,%edi
mov    $0xc0,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1050 <sub_i32@plt>
cmp    $0xfffffffe,%eax
je     1286 <test_sub+0x136>
xor    %edi,%edi
mov    $0xc3,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1050 <sub_i32@plt>
cmp    $0x2,%eax
je     12b2 <test_sub+0x162>
xor    %edi,%edi
mov    $0xc5,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <sub_i32@plt>
cmp    $0x0,%eax
je     12db <test_sub+0x18b>
xor    %edi,%edi
mov    $0xc7,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1060 <sub_i64@plt>
cmp    $0xfffffffe,%eax
je     1307 <test_sub+0x1b7>
xor    %edi,%edi
mov    $0xca,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <sub_i64@plt>
cmp    $0x2,%eax
je     1333 <test_sub+0x1e3>
xor    %edi,%edi
mov    $0xcc,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
mov    $0x1,%esi
mov    %esi,%edi
call   1060 <sub_i64@plt>
cmp    $0x0,%eax
je     135c <test_sub+0x20c>
xor    %edi,%edi
mov    $0xce,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1363 <test_sub+0x213>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sub>:
push   %rax
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1070 <sub_i8@plt>
mov    $0xb5,%esi
cmp    $0xfffffffe,%eax
jne    1291 <test_sub+0x141>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1070 <sub_i8@plt>
mov    $0xb7,%esi
cmp    $0x2,%eax
jne    1291 <test_sub+0x141>
mov    $0x1,%edi
mov    $0x1,%esi
call   1070 <sub_i8@plt>
mov    $0xb9,%esi
test   %eax,%eax
jne    1291 <test_sub+0x141>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1030 <sub_i16@plt>
mov    $0xbc,%esi
cmp    $0xfffffffe,%eax
jne    1291 <test_sub+0x141>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1030 <sub_i16@plt>
mov    $0xbe,%esi
cmp    $0x2,%eax
jne    1291 <test_sub+0x141>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <sub_i16@plt>
mov    $0xc0,%esi
test   %eax,%eax
jne    1291 <test_sub+0x141>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1050 <sub_i32@plt>
mov    $0xc3,%esi
cmp    $0xfffffffe,%eax
jne    1291 <test_sub+0x141>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1050 <sub_i32@plt>
mov    $0xc5,%esi
cmp    $0x2,%eax
jne    1291 <test_sub+0x141>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <sub_i32@plt>
mov    $0xc7,%esi
test   %eax,%eax
jne    1291 <test_sub+0x141>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1060 <sub_i64@plt>
mov    $0xca,%esi
cmp    $0xfffffffe,%eax
jne    1291 <test_sub+0x141>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <sub_i64@plt>
mov    $0xcc,%esi
cmp    $0x2,%eax
jne    1291 <test_sub+0x141>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <sub_i64@plt>
mov    $0xce,%esi
test   %eax,%eax
je     1299 <test_sub+0x149>
xor    %edi,%edi
pop    %rax
jmp    1040 <fail_real@plt>
mov    $0x4,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test_sub() {
%1 = alloca i32
%2 = call i32 @sub_i8(i32 -1, i32 1)
%3 = icmp ne i32 %2, -2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @fail_real(i32 0, i32 181)
store i32 %5, i32* %1
br label %62
6: ; preds = %0
%7 = call i32 @sub_i8(i32 1, i32 -1)
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @fail_real(i32 0, i32 183)
store i32 %10, i32* %1
br label %62
11: ; preds = %6
%12 = call i32 @sub_i8(i32 1, i32 1)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @fail_real(i32 0, i32 185)
store i32 %15, i32* %1
br label %62
16: ; preds = %11
%17 = call i32 @sub_i16(i32 -1, i32 1)
%18 = icmp ne i32 %17, -2
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @fail_real(i32 0, i32 188)
store i32 %20, i32* %1
br label %62
21: ; preds = %16
%22 = call i32 @sub_i16(i32 1, i32 -1)
%23 = icmp ne i32 %22, 2
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @fail_real(i32 0, i32 190)
store i32 %25, i32* %1
br label %62
26: ; preds = %21
%27 = call i32 @sub_i16(i32 1, i32 1)
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @fail_real(i32 0, i32 192)
store i32 %30, i32* %1
br label %62
31: ; preds = %26
%32 = call i32 @sub_i32(i32 -1, i32 1)
%33 = icmp ne i32 %32, -2
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @fail_real(i32 0, i32 195)
store i32 %35, i32* %1
br label %62
36: ; preds = %31
%37 = call i32 @sub_i32(i32 1, i32 -1)
%38 = icmp ne i32 %37, 2
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @fail_real(i32 0, i32 197)
store i32 %40, i32* %1
br label %62
41: ; preds = %36
%42 = call i32 @sub_i32(i32 1, i32 1)
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @fail_real(i32 0, i32 199)
store i32 %45, i32* %1
br label %62
46: ; preds = %41
%47 = call i32 @sub_i64(i32 -1, i32 1)
%48 = icmp ne i32 %47, -2
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @fail_real(i32 0, i32 202)
store i32 %50, i32* %1
br label %62
51: ; preds = %46
%52 = call i32 @sub_i64(i32 1, i32 -1)
%53 = icmp ne i32 %52, 2
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 @fail_real(i32 0, i32 204)
store i32 %55, i32* %1
br label %62
56: ; preds = %51
%57 = call i32 @sub_i64(i32 1, i32 1)
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 @fail_real(i32 0, i32 206)
store i32 %60, i32* %1
br label %62
61: ; preds = %56
store i32 4, i32* %1
br label %62
62: ; preds = %61, %59, %54, %49, %44, %39, %34, %29, %24, %19, %14, %9, %4
%63 = load i32, i32* %1
ret i32 %63
}

LLVM IR (-O2):
define i32 @test_sub() {
%1 = tail call i32 @sub_i8(i32 -1, i32 1)
%2 = icmp eq i32 %1, -2
br i1 %2, label %3, label %36
3: ; preds = %0
%4 = tail call i32 @sub_i8(i32 1, i32 -1)
%5 = icmp eq i32 %4, 2
br i1 %5, label %6, label %36
6: ; preds = %3
%7 = tail call i32 @sub_i8(i32 1, i32 1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %36
9: ; preds = %6
%10 = tail call i32 @sub_i16(i32 -1, i32 1)
%11 = icmp eq i32 %10, -2
br i1 %11, label %12, label %36
12: ; preds = %9
%13 = tail call i32 @sub_i16(i32 1, i32 -1)
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %36
15: ; preds = %12
%16 = tail call i32 @sub_i16(i32 1, i32 1)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %36
18: ; preds = %15
%19 = tail call i32 @sub_i32(i32 -1, i32 1)
%20 = icmp eq i32 %19, -2
br i1 %20, label %21, label %36
21: ; preds = %18
%22 = tail call i32 @sub_i32(i32 1, i32 -1)
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %36
24: ; preds = %21
%25 = tail call i32 @sub_i32(i32 1, i32 1)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = tail call i32 @sub_i64(i32 -1, i32 1)
%29 = icmp eq i32 %28, -2
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = tail call i32 @sub_i64(i32 1, i32 -1)
%32 = icmp eq i32 %31, 2
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = tail call i32 @sub_i64(i32 1, i32 1)
%35 = icmp eq i32 %34, 0
br i1 %35, label %39, label %36
36: ; preds = %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
%37 = phi i32 [ 181, %0 ], [ 183, %3 ], [ 185, %6 ], [ 188, %9 ], [ 190, %12 ], [ 192, %15 ], [ 195, %18 ], [ 197, %21 ], [ 199, %24 ], [ 202, %27 ], [ 204, %30 ], [ 206, %33 ]
%38 = tail call i32 @fail_real(i32 0, i32 %37)
br label %39
39: ; preds = %36, %33
%40 = phi i32 [ 4, %33 ], [ %38, %36 ]
ret i32 %40
}