#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(int /*<<< orphan*/);
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(0);
  if (sub_i8(1, -1) != 2)
    return fail(0);
  if (sub_i8(1, 1) != 0)
    return fail(0);
  if (sub_i16(-1, 1) != -2)
    return fail(0);
  if (sub_i16(1, -1) != 2)
    return fail(0);
  if (sub_i16(1, 1) != 0)
    return fail(0);
  if (sub_i32(-1, 1) != -2)
    return fail(0);
  if (sub_i32(1, -1) != 2)
    return fail(0);
  if (sub_i32(1, 1) != 0)
    return fail(0);
  if (sub_i64(-1, 1) != -2)
    return fail(0);
  if (sub_i64(1, -1) != 2)
    return fail(0);
  if (sub_i64(1, 1) != 0)
    return fail(0);
  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     117f <test_sub+0x2f>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1070 <sub_i8@plt>
cmp    $0x2,%eax
je     11a6 <test_sub+0x56>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0x1,%esi
mov    %esi,%edi
call   1070 <sub_i8@plt>
cmp    $0x0,%eax
je     11ca <test_sub+0x7a>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1030 <sub_i16@plt>
cmp    $0xfffffffe,%eax
je     11f1 <test_sub+0xa1>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1030 <sub_i16@plt>
cmp    $0x2,%eax
je     1218 <test_sub+0xc8>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <sub_i16@plt>
cmp    $0x0,%eax
je     123c <test_sub+0xec>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1050 <sub_i32@plt>
cmp    $0xfffffffe,%eax
je     1263 <test_sub+0x113>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1050 <sub_i32@plt>
cmp    $0x2,%eax
je     128a <test_sub+0x13a>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <sub_i32@plt>
cmp    $0x0,%eax
je     12ae <test_sub+0x15e>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1060 <sub_i64@plt>
cmp    $0xfffffffe,%eax
je     12d5 <test_sub+0x185>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <sub_i64@plt>
cmp    $0x2,%eax
je     12fc <test_sub+0x1ac>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
mov    $0x1,%esi
mov    %esi,%edi
call   1060 <sub_i64@plt>
cmp    $0x0,%eax
je     1320 <test_sub+0x1d0>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    1327 <test_sub+0x1d7>
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>
cmp    $0xfffffffe,%eax
jne    1251 <test_sub+0x101>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1070 <sub_i8@plt>
cmp    $0x2,%eax
jne    1251 <test_sub+0x101>
mov    $0x1,%edi
mov    $0x1,%esi
call   1070 <sub_i8@plt>
test   %eax,%eax
jne    1251 <test_sub+0x101>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1030 <sub_i16@plt>
cmp    $0xfffffffe,%eax
jne    1251 <test_sub+0x101>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1030 <sub_i16@plt>
cmp    $0x2,%eax
jne    1251 <test_sub+0x101>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <sub_i16@plt>
test   %eax,%eax
jne    1251 <test_sub+0x101>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1050 <sub_i32@plt>
cmp    $0xfffffffe,%eax
jne    1251 <test_sub+0x101>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1050 <sub_i32@plt>
cmp    $0x2,%eax
jne    1251 <test_sub+0x101>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <sub_i32@plt>
test   %eax,%eax
jne    1251 <test_sub+0x101>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1060 <sub_i64@plt>
cmp    $0xfffffffe,%eax
jne    1251 <test_sub+0x101>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <sub_i64@plt>
cmp    $0x2,%eax
jne    1251 <test_sub+0x101>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <sub_i64@plt>
test   %eax,%eax
je     1259 <test_sub+0x109>
xor    %edi,%edi
pop    %rax
jmp    1040 <fail@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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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(i32 0)
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 %38, label %36
36: ; preds = %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
%37 = tail call i32 @fail(i32 0)
br label %38
38: ; preds = %36, %33
%39 = phi i32 [ 4, %33 ], [ %37, %36 ]
ret i32 %39
}