#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 add_i16(int, int);
int add_i32(unsigned int, int);
int add_i64(unsigned long long, int);
int add_i8(int, int);
int fail(int /*<<< orphan*/);
int test_add(void) {
  if (add_i8(1, 1) != 2)
    return fail(0);
  if (add_i8(1, -1) != 0)
    return fail(0);
  if (add_i8(-1, -1) != -2)
    return fail(0);
  if (add_i8(255, 1) != 0)
    return fail(0);
  if (add_i16(1, 1) != 2)
    return fail(0);
  if (add_i16(1, -1) != 0)
    return fail(0);
  if (add_i16(-1, -1) != -2)
    return fail(0);
  if (add_i16(65535, 1) != 0)
    return fail(0);
  if (add_i32(1, 1) != 2)
    return fail(0);
  if (add_i32(1, -1) != 0)
    return fail(0);
  if (add_i32(-1, -1) != -2)
    return fail(0);
  if (add_i32(~0u, 1) != 0)
    return fail(0);
  if (add_i64(1, 1) != 2)
    return fail(0);
  if (add_i64(1, -1) != 0)
    return fail(0);
  if (add_i64(-1, -1) != -2)
    return fail(0);
  if (add_i64(~0ull, 1) != 0)
    return fail(0);
  return 0x1;
}


x86 assembly (clang, -O0):
<test_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%esi
mov    %esi,%edi
call   1070 <add_i8@plt>
cmp    $0x2,%eax
je     117c <test_add+0x2c>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1070 <add_i8@plt>
cmp    $0x0,%eax
je     11a3 <test_add+0x53>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1070 <add_i8@plt>
cmp    $0xfffffffe,%eax
je     11c7 <test_add+0x77>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0xff,%edi
mov    $0x1,%esi
call   1070 <add_i8@plt>
cmp    $0x0,%eax
je     11ee <test_add+0x9e>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <add_i16@plt>
cmp    $0x2,%eax
je     1212 <test_add+0xc2>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1040 <add_i16@plt>
cmp    $0x0,%eax
je     1239 <test_add+0xe9>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1040 <add_i16@plt>
cmp    $0xfffffffe,%eax
je     125d <test_add+0x10d>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0xffff,%edi
mov    $0x1,%esi
call   1040 <add_i16@plt>
cmp    $0x0,%eax
je     1284 <test_add+0x134>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0x1,%esi
mov    %esi,%edi
call   1060 <add_i32@plt>
cmp    $0x2,%eax
je     12a8 <test_add+0x158>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <add_i32@plt>
cmp    $0x0,%eax
je     12cf <test_add+0x17f>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1060 <add_i32@plt>
cmp    $0xfffffffe,%eax
je     12f3 <test_add+0x1a3>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1060 <add_i32@plt>
cmp    $0x0,%eax
je     131a <test_add+0x1ca>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <add_i64@plt>
cmp    $0x2,%eax
je     1341 <test_add+0x1f1>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1050 <add_i64@plt>
cmp    $0x0,%eax
je     1368 <test_add+0x218>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0xffffffffffffffff,%rdi
mov    $0xffffffff,%esi
call   1050 <add_i64@plt>
cmp    $0xfffffffe,%eax
je     1391 <test_add+0x241>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
mov    $0xffffffffffffffff,%rdi
mov    $0x1,%esi
call   1050 <add_i64@plt>
cmp    $0x0,%eax
je     13ba <test_add+0x26a>
xor    %edi,%edi
call   1030 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    13c1 <test_add+0x271>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_add>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
call   1070 <add_i8@plt>
cmp    $0x2,%eax
jne    12b1 <test_add+0x161>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1070 <add_i8@plt>
test   %eax,%eax
jne    12b1 <test_add+0x161>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1070 <add_i8@plt>
cmp    $0xfffffffe,%eax
jne    12b1 <test_add+0x161>
mov    $0xff,%edi
mov    $0x1,%esi
call   1070 <add_i8@plt>
test   %eax,%eax
jne    12b1 <test_add+0x161>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <add_i16@plt>
cmp    $0x2,%eax
jne    12b1 <test_add+0x161>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1040 <add_i16@plt>
test   %eax,%eax
jne    12b1 <test_add+0x161>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1040 <add_i16@plt>
cmp    $0xfffffffe,%eax
jne    12b1 <test_add+0x161>
mov    $0xffff,%edi
mov    $0x1,%esi
call   1040 <add_i16@plt>
test   %eax,%eax
jne    12b1 <test_add+0x161>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <add_i32@plt>
cmp    $0x2,%eax
jne    12b1 <test_add+0x161>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <add_i32@plt>
test   %eax,%eax
jne    12b1 <test_add+0x161>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1060 <add_i32@plt>
cmp    $0xfffffffe,%eax
jne    12b1 <test_add+0x161>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1060 <add_i32@plt>
test   %eax,%eax
jne    12b1 <test_add+0x161>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <add_i64@plt>
cmp    $0x2,%eax
jne    12b1 <test_add+0x161>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1050 <add_i64@plt>
test   %eax,%eax
jne    12b1 <test_add+0x161>
mov    $0xffffffffffffffff,%rdi
mov    $0xffffffff,%esi
call   1050 <add_i64@plt>
cmp    $0xfffffffe,%eax
jne    12b1 <test_add+0x161>
mov    $0xffffffffffffffff,%rdi
mov    $0x1,%esi
call   1050 <add_i64@plt>
test   %eax,%eax
je     12b9 <test_add+0x169>
xor    %edi,%edi
pop    %rax
jmp    1030 <fail@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test_add() {
%1 = alloca i32
%2 = call i32 @add_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 %82
6: ; preds = %0
%7 = call i32 @add_i8(i32 1, i32 -1)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @fail(i32 0)
store i32 %10, i32* %1
br label %82
11: ; preds = %6
%12 = call i32 @add_i8(i32 -1, i32 -1)
%13 = icmp ne i32 %12, -2
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @fail(i32 0)
store i32 %15, i32* %1
br label %82
16: ; preds = %11
%17 = call i32 @add_i8(i32 255, i32 1)
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @fail(i32 0)
store i32 %20, i32* %1
br label %82
21: ; preds = %16
%22 = call i32 @add_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 %82
26: ; preds = %21
%27 = call i32 @add_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 %82
31: ; preds = %26
%32 = call i32 @add_i16(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 %82
36: ; preds = %31
%37 = call i32 @add_i16(i32 65535, i32 1)
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @fail(i32 0)
store i32 %40, i32* %1
br label %82
41: ; preds = %36
%42 = call i32 @add_i32(i32 1, i32 1)
%43 = icmp ne i32 %42, 2
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @fail(i32 0)
store i32 %45, i32* %1
br label %82
46: ; preds = %41
%47 = call i32 @add_i32(i32 1, i32 -1)
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @fail(i32 0)
store i32 %50, i32* %1
br label %82
51: ; preds = %46
%52 = call i32 @add_i32(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 %82
56: ; preds = %51
%57 = call i32 @add_i32(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 %82
61: ; preds = %56
%62 = call i32 @add_i64(i64 1, i32 1)
%63 = icmp ne i32 %62, 2
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = call i32 @fail(i32 0)
store i32 %65, i32* %1
br label %82
66: ; preds = %61
%67 = call i32 @add_i64(i64 1, i32 -1)
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %66
%70 = call i32 @fail(i32 0)
store i32 %70, i32* %1
br label %82
71: ; preds = %66
%72 = call i32 @add_i64(i64 -1, i32 -1)
%73 = icmp ne i32 %72, -2
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = call i32 @fail(i32 0)
store i32 %75, i32* %1
br label %82
76: ; preds = %71
%77 = call i32 @add_i64(i64 -1, i32 1)
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %76
%80 = call i32 @fail(i32 0)
store i32 %80, i32* %1
br label %82
81: ; preds = %76
store i32 1, i32* %1
br label %82
82: ; preds = %81, %79, %74, %69, %64, %59, %54, %49, %44, %39, %34, %29, %24, %19, %14, %9, %4
%83 = load i32, i32* %1
ret i32 %83
}

LLVM IR (-O2):
define i32 @test_add() {
%1 = tail call i32 @add_i8(i32 1, i32 1)
%2 = icmp eq i32 %1, 2
br i1 %2, label %3, label %48
3: ; preds = %0
%4 = tail call i32 @add_i8(i32 1, i32 -1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %48
6: ; preds = %3
%7 = tail call i32 @add_i8(i32 -1, i32 -1)
%8 = icmp eq i32 %7, -2
br i1 %8, label %9, label %48
9: ; preds = %6
%10 = tail call i32 @add_i8(i32 255, i32 1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %48
12: ; preds = %9
%13 = tail call i32 @add_i16(i32 1, i32 1)
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %48
15: ; preds = %12
%16 = tail call i32 @add_i16(i32 1, i32 -1)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %48
18: ; preds = %15
%19 = tail call i32 @add_i16(i32 -1, i32 -1)
%20 = icmp eq i32 %19, -2
br i1 %20, label %21, label %48
21: ; preds = %18
%22 = tail call i32 @add_i16(i32 65535, i32 1)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %48
24: ; preds = %21
%25 = tail call i32 @add_i32(i32 1, i32 1)
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %48
27: ; preds = %24
%28 = tail call i32 @add_i32(i32 1, i32 -1)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %48
30: ; preds = %27
%31 = tail call i32 @add_i32(i32 -1, i32 -1)
%32 = icmp eq i32 %31, -2
br i1 %32, label %33, label %48
33: ; preds = %30
%34 = tail call i32 @add_i32(i32 -1, i32 1)
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %48
36: ; preds = %33
%37 = tail call i32 @add_i64(i64 1, i32 1)
%38 = icmp eq i32 %37, 2
br i1 %38, label %39, label %48
39: ; preds = %36
%40 = tail call i32 @add_i64(i64 1, i32 -1)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = tail call i32 @add_i64(i64 -1, i32 -1)
%44 = icmp eq i32 %43, -2
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = tail call i32 @add_i64(i64 -1, i32 1)
%47 = icmp eq i32 %46, 0
br i1 %47, label %50, label %48
48: ; preds = %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
%49 = tail call i32 @fail(i32 0)
br label %50
50: ; preds = %48, %45
%51 = phi i32 [ 1, %45 ], [ %49, %48 ]
ret i32 %51
}