#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 /*<<< orphan*/ abort();
int bar(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(int, int);
int main() {
  if (foo(-2, 0xffff) != -131070)
    abort();
  if (foo(2, 0xffff) != 131070)
    abort();
  if (foo(-32768, 0x8000) != -1073741824)
    abort();
  if (foo(32767, 0x8000) != 1073709056)
    abort();
  if (bar(0xffff, -2) != -131070)
    abort();
  if (bar(0xffff, 2) != 131070)
    abort();
  if (bar(0x8000, -32768) != -1073741824)
    abort();
  if (bar(0x8000, 32767) != 1073709056)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xfffffffe,%edi
mov    $0xffff,%esi
call   1050 <foo@plt>
cmp    $0xfffe0002,%eax
je     1170 <main+0x30>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x2,%edi
mov    $0xffff,%esi
call   1050 <foo@plt>
cmp    $0x1fffe,%eax
je     1191 <main+0x51>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0xffff8000,%edi
mov    $0x8000,%esi
call   1050 <foo@plt>
cmp    $0xc0000000,%eax
je     11b2 <main+0x72>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x7fff,%edi
mov    $0x8000,%esi
call   1050 <foo@plt>
cmp    $0x3fff8000,%eax
je     11d3 <main+0x93>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0xffff,%edi
mov    $0xfffffffe,%esi
call   1040 <bar@plt>
cmp    $0xfffe0002,%eax
je     11f4 <main+0xb4>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0xffff,%edi
mov    $0x2,%esi
call   1040 <bar@plt>
cmp    $0x1fffe,%eax
je     1215 <main+0xd5>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x8000,%edi
mov    $0xffff8000,%esi
call   1040 <bar@plt>
cmp    $0xc0000000,%eax
je     1236 <main+0xf6>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x8000,%edi
mov    $0x7fff,%esi
call   1040 <bar@plt>
cmp    $0x3fff8000,%eax
je     1257 <main+0x117>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xfffffffe,%edi
mov    $0xffff,%esi
call   1050 <foo@plt>
cmp    $0xfffe0002,%eax
jne    1200 <main+0xc0>
mov    $0x2,%edi
mov    $0xffff,%esi
call   1050 <foo@plt>
cmp    $0x1fffe,%eax
jne    1200 <main+0xc0>
mov    $0xffff8000,%edi
mov    $0x8000,%esi
call   1050 <foo@plt>
cmp    $0xc0000000,%eax
jne    1200 <main+0xc0>
mov    $0x7fff,%edi
mov    $0x8000,%esi
call   1050 <foo@plt>
cmp    $0x3fff8000,%eax
jne    1200 <main+0xc0>
mov    $0xffff,%edi
mov    $0xfffffffe,%esi
call   1040 <bar@plt>
cmp    $0xfffe0002,%eax
jne    1200 <main+0xc0>
mov    $0xffff,%edi
mov    $0x2,%esi
call   1040 <bar@plt>
cmp    $0x1fffe,%eax
jne    1200 <main+0xc0>
mov    $0x8000,%edi
mov    $0xffff8000,%esi
call   1040 <bar@plt>
cmp    $0xc0000000,%eax
jne    1200 <main+0xc0>
mov    $0x8000,%edi
mov    $0x7fff,%esi
call   1040 <bar@plt>
cmp    $0x3fff8000,%eax
jne    1200 <main+0xc0>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 -2, i32 65535)
%3 = icmp ne i32 %2, -131070
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @foo(i32 2, i32 65535)
%8 = icmp ne i32 %7, 131070
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @foo(i32 -32768, i32 32768)
%13 = icmp ne i32 %12, -1073741824
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
%17 = call i32 @foo(i32 32767, i32 32768)
%18 = icmp ne i32 %17, 1073709056
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @abort()
unreachable
21: ; preds = %16
%22 = call i32 @bar(i32 65535, i32 -2)
%23 = icmp ne i32 %22, -131070
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (...) @abort()
unreachable
26: ; preds = %21
%27 = call i32 @bar(i32 65535, i32 2)
%28 = icmp ne i32 %27, 131070
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (...) @abort()
unreachable
31: ; preds = %26
%32 = call i32 @bar(i32 32768, i32 -32768)
%33 = icmp ne i32 %32, -1073741824
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 (...) @abort()
unreachable
36: ; preds = %31
%37 = call i32 @bar(i32 32768, i32 32767)
%38 = icmp ne i32 %37, 1073709056
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 (...) @abort()
unreachable
41: ; preds = %36
%42 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 -2, i32 65535)
%2 = icmp eq i32 %1, -131070
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @foo(i32 2, i32 65535)
%7 = icmp eq i32 %6, 131070
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @foo(i32 -32768, i32 32768)
%12 = icmp eq i32 %11, -1073741824
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
%16 = tail call i32 @foo(i32 32767, i32 32768)
%17 = icmp eq i32 %16, 1073709056
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (...) @abort()
unreachable
20: ; preds = %15
%21 = tail call i32 @bar(i32 65535, i32 -2)
%22 = icmp eq i32 %21, -131070
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = tail call i32 (...) @abort()
unreachable
25: ; preds = %20
%26 = tail call i32 @bar(i32 65535, i32 2)
%27 = icmp eq i32 %26, 131070
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 (...) @abort()
unreachable
30: ; preds = %25
%31 = tail call i32 @bar(i32 32768, i32 -32768)
%32 = icmp eq i32 %31, -1073741824
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = tail call i32 (...) @abort()
unreachable
35: ; preds = %30
%36 = tail call i32 @bar(i32 32768, i32 32767)
%37 = icmp eq i32 %36, 1073709056
br i1 %37, label %40, label %38
38: ; preds = %35
%39 = tail call i32 (...) @abort()
unreachable
40: ; preds = %35
%41 = tail call i32 @exit(i32 0)
unreachable
}