#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_real(int /*<<< orphan*/, int);
int test_add(void) {
  if (add_i8(1, 1) != 2)
    return fail_real(0, 124);
  if (add_i8(1, -1) != 0)
    return fail_real(0, 126);
  if (add_i8(-1, -1) != -2)
    return fail_real(0, 128);
  if (add_i8(255, 1) != 0)
    return fail_real(0, 130);
  if (add_i16(1, 1) != 2)
    return fail_real(0, 133);
  if (add_i16(1, -1) != 0)
    return fail_real(0, 135);
  if (add_i16(-1, -1) != -2)
    return fail_real(0, 137);
  if (add_i16(65535, 1) != 0)
    return fail_real(0, 139);
  if (add_i32(1, 1) != 2)
    return fail_real(0, 142);
  if (add_i32(1, -1) != 0)
    return fail_real(0, 144);
  if (add_i32(-1, -1) != -2)
    return fail_real(0, 146);
  if (add_i32(~0u, 1) != 0)
    return fail_real(0, 148);
  if (add_i64(1, 1) != 2)
    return fail_real(0, 151);
  if (add_i64(1, -1) != 0)
    return fail_real(0, 153);
  if (add_i64(-1, -1) != -2)
    return fail_real(0, 155);
  if (add_i64(~0ull, 1) != 0)
    return fail_real(0, 157);
  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     1181 <test_add+0x31>
xor    %edi,%edi
mov    $0x7c,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1070 <add_i8@plt>
cmp    $0x0,%eax
je     11ad <test_add+0x5d>
xor    %edi,%edi
mov    $0x7e,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1070 <add_i8@plt>
cmp    $0xfffffffe,%eax
je     11d6 <test_add+0x86>
xor    %edi,%edi
mov    $0x80,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0xff,%edi
mov    $0x1,%esi
call   1070 <add_i8@plt>
cmp    $0x0,%eax
je     1202 <test_add+0xb2>
xor    %edi,%edi
mov    $0x82,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <add_i16@plt>
cmp    $0x2,%eax
je     122b <test_add+0xdb>
xor    %edi,%edi
mov    $0x85,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1040 <add_i16@plt>
cmp    $0x0,%eax
je     1257 <test_add+0x107>
xor    %edi,%edi
mov    $0x87,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1040 <add_i16@plt>
cmp    $0xfffffffe,%eax
je     1280 <test_add+0x130>
xor    %edi,%edi
mov    $0x89,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0xffff,%edi
mov    $0x1,%esi
call   1040 <add_i16@plt>
cmp    $0x0,%eax
je     12ac <test_add+0x15c>
xor    %edi,%edi
mov    $0x8b,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0x1,%esi
mov    %esi,%edi
call   1060 <add_i32@plt>
cmp    $0x2,%eax
je     12d5 <test_add+0x185>
xor    %edi,%edi
mov    $0x8e,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <add_i32@plt>
cmp    $0x0,%eax
je     1301 <test_add+0x1b1>
xor    %edi,%edi
mov    $0x90,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1060 <add_i32@plt>
cmp    $0xfffffffe,%eax
je     132a <test_add+0x1da>
xor    %edi,%edi
mov    $0x92,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1060 <add_i32@plt>
cmp    $0x0,%eax
je     1356 <test_add+0x206>
xor    %edi,%edi
mov    $0x94,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <add_i64@plt>
cmp    $0x2,%eax
je     1382 <test_add+0x232>
xor    %edi,%edi
mov    $0x97,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1050 <add_i64@plt>
cmp    $0x0,%eax
je     13ae <test_add+0x25e>
xor    %edi,%edi
mov    $0x99,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0xffffffffffffffff,%rdi
mov    $0xffffffff,%esi
call   1050 <add_i64@plt>
cmp    $0xfffffffe,%eax
je     13dc <test_add+0x28c>
xor    %edi,%edi
mov    $0x9b,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
mov    $0xffffffffffffffff,%rdi
mov    $0x1,%esi
call   1050 <add_i64@plt>
cmp    $0x0,%eax
je     140a <test_add+0x2ba>
xor    %edi,%edi
mov    $0x9d,%esi
call   1030 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    1411 <test_add+0x2c1>
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>
mov    $0x7c,%esi
cmp    $0x2,%eax
jne    1305 <test_add+0x1b5>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1070 <add_i8@plt>
mov    $0x7e,%esi
test   %eax,%eax
jne    1305 <test_add+0x1b5>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1070 <add_i8@plt>
mov    $0x80,%esi
cmp    $0xfffffffe,%eax
jne    1305 <test_add+0x1b5>
mov    $0xff,%edi
mov    $0x1,%esi
call   1070 <add_i8@plt>
mov    $0x82,%esi
test   %eax,%eax
jne    1305 <test_add+0x1b5>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <add_i16@plt>
mov    $0x85,%esi
cmp    $0x2,%eax
jne    1305 <test_add+0x1b5>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1040 <add_i16@plt>
mov    $0x87,%esi
test   %eax,%eax
jne    1305 <test_add+0x1b5>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1040 <add_i16@plt>
mov    $0x89,%esi
cmp    $0xfffffffe,%eax
jne    1305 <test_add+0x1b5>
mov    $0xffff,%edi
mov    $0x1,%esi
call   1040 <add_i16@plt>
mov    $0x8b,%esi
test   %eax,%eax
jne    1305 <test_add+0x1b5>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <add_i32@plt>
mov    $0x8e,%esi
cmp    $0x2,%eax
jne    1305 <test_add+0x1b5>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <add_i32@plt>
mov    $0x90,%esi
test   %eax,%eax
jne    1305 <test_add+0x1b5>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1060 <add_i32@plt>
mov    $0x92,%esi
cmp    $0xfffffffe,%eax
jne    1305 <test_add+0x1b5>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1060 <add_i32@plt>
mov    $0x94,%esi
test   %eax,%eax
jne    1305 <test_add+0x1b5>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <add_i64@plt>
mov    $0x97,%esi
cmp    $0x2,%eax
jne    1305 <test_add+0x1b5>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1050 <add_i64@plt>
mov    $0x99,%esi
test   %eax,%eax
jne    1305 <test_add+0x1b5>
mov    $0xffffffffffffffff,%rdi
mov    $0xffffffff,%esi
call   1050 <add_i64@plt>
mov    $0x9b,%esi
cmp    $0xfffffffe,%eax
jne    1305 <test_add+0x1b5>
mov    $0xffffffffffffffff,%rdi
mov    $0x1,%esi
call   1050 <add_i64@plt>
mov    $0x9d,%esi
test   %eax,%eax
je     130d <test_add+0x1bd>
xor    %edi,%edi
pop    %rax
jmp    1030 <fail_real@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_real(i32 0, i32 124)
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_real(i32 0, i32 126)
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_real(i32 0, i32 128)
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_real(i32 0, i32 130)
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_real(i32 0, i32 133)
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_real(i32 0, i32 135)
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_real(i32 0, i32 137)
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_real(i32 0, i32 139)
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_real(i32 0, i32 142)
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_real(i32 0, i32 144)
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_real(i32 0, i32 146)
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_real(i32 0, i32 148)
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_real(i32 0, i32 151)
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_real(i32 0, i32 153)
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_real(i32 0, i32 155)
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_real(i32 0, i32 157)
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 %51, label %48
48: ; preds = %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
%49 = phi i32 [ 124, %0 ], [ 126, %3 ], [ 128, %6 ], [ 130, %9 ], [ 133, %12 ], [ 135, %15 ], [ 137, %18 ], [ 139, %21 ], [ 142, %24 ], [ 144, %27 ], [ 146, %30 ], [ 148, %33 ], [ 151, %36 ], [ 153, %39 ], [ 155, %42 ], [ 157, %45 ]
%50 = tail call i32 @fail_real(i32 0, i32 %49)
br label %51
51: ; preds = %48, %45
%52 = phi i32 [ 1, %45 ], [ %50, %48 ]
ret i32 %52
}