int main(void) {
  volatile signed char c = -(-0x7f - 1);
  ({
    if ((c) != (-128))
      __builtin_abort();
  });
  volatile short s = -(-0x7fff - 1);
  ({
    if ((s) != (-32768))
      __builtin_abort();
  });
  volatile int i = (-0x7fffffff - 1);
  i = -(unsigned)i;
  ({
    if ((i) != (-0x80000000))
      __builtin_abort();
  });
  volatile long int li = (-0x7fffffffffffffffL - 1L);
  li = -(unsigned long)li;
  ({
    if ((li) != (-0x8000000000000000L))
      __builtin_abort();
  });
  volatile long long lli = (-0x7fffffffffffffffLL - 1LL);
  lli = -(unsigned long long)lli;
  ({
    if ((lli) != (-0x8000000000000000L))
      __builtin_abort();
  });
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x80,-0x5(%rbp)
mov    -0x5(%rbp),%al
movsbl %al,%eax
cmp    $0xffffff80,%eax
je     1137 <main+0x27>
call   1030 <abort@plt>
movw   $0x8000,-0x8(%rbp)
mov    -0x8(%rbp),%ax
cwtl
cmp    $0xffff8000,%eax
je     1152 <main+0x42>
call   1030 <abort@plt>
movl   $0x80000000,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x80000000,%eax
je     1176 <main+0x66>
call   1030 <abort@plt>
movabs $0x8000000000000000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movabs $0x8000000000000000,%rcx
cmp    %rcx,%rax
je     11ad <main+0x9d>
call   1030 <abort@plt>
movabs $0x8000000000000000,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movabs $0x8000000000000000,%rcx
cmp    %rcx,%rax
je     11e4 <main+0xd4>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movb   $0x80,0x1(%rsp)
mov    0x1(%rsp),%al
cmp    $0x80,%al
jne    1184 <main+0x74>
movw   $0x8000,0x2(%rsp)
movzwl 0x2(%rsp),%eax
cmp    $0x8000,%eax
jne    1184 <main+0x74>
movl   $0x80000000,0x4(%rsp)
80
negl   0x4(%rsp)
mov    0x4(%rsp),%eax
cmp    $0x80000000,%eax
jne    1184 <main+0x74>
movabs $0x8000000000000000,%rax
mov    %rax,0x10(%rsp)
negq   0x10(%rsp)
mov    0x10(%rsp),%rcx
cmp    %rax,%rcx
jne    1184 <main+0x74>
mov    %rax,0x8(%rsp)
negq   0x8(%rsp)
mov    0x8(%rsp),%rcx
cmp    %rax,%rcx
jne    1184 <main+0x74>
xor    %eax,%eax
add    $0x18,%rsp
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i16
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32 0, i32* %1
store volatile i8 -128, i8* %2
%7 = load volatile i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, -128
br i1 %9, label %10, label %11
10: ; preds = %0
unreachable
11: ; preds = %0
store volatile i16 -32768, i16* %3
%12 = load volatile i16, i16* %3
%13 = sext i16 %12 to i32
%14 = icmp ne i32 %13, -32768
br i1 %14, label %15, label %16
15: ; preds = %11
unreachable
16: ; preds = %11
store volatile i32 -2147483648, i32* %4
%17 = load volatile i32, i32* %4
%18 = sub i32 0, %17
store volatile i32 %18, i32* %4
%19 = load volatile i32, i32* %4
%20 = icmp ne i32 %19, -2147483648
br i1 %20, label %21, label %22
21: ; preds = %16
unreachable
22: ; preds = %16
store volatile i64 -9223372036854775808, i64* %5
%23 = load volatile i64, i64* %5
%24 = sub i64 0, %23
store volatile i64 %24, i64* %5
%25 = load volatile i64, i64* %5
%26 = icmp ne i64 %25, -9223372036854775808
br i1 %26, label %27, label %28
27: ; preds = %22
unreachable
28: ; preds = %22
store volatile i64 -9223372036854775808, i64* %6
%29 = load volatile i64, i64* %6
%30 = sub i64 0, %29
store volatile i64 %30, i64* %6
%31 = load volatile i64, i64* %6
%32 = icmp ne i64 %31, -9223372036854775808
br i1 %32, label %33, label %34
33: ; preds = %28
unreachable
34: ; preds = %28
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i8
%2 = alloca i16
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store volatile i8 -128, i8* %1
%6 = load volatile i8, i8* %1
%7 = icmp eq i8 %6, -128
br i1 %7, label %9, label %8
8: ; preds = %0
tail call void @abort()
unreachable
9: ; preds = %0
%10 = bitcast i16* %2 to i8*
store volatile i16 -32768, i16* %2
%11 = load volatile i16, i16* %2
%12 = icmp eq i16 %11, -32768
br i1 %12, label %14, label %13
13: ; preds = %9
tail call void @abort()
unreachable
14: ; preds = %9
%15 = bitcast i32* %3 to i8*
store volatile i32 -2147483648, i32* %3
%16 = load volatile i32, i32* %3
%17 = sub i32 0, %16
store volatile i32 %17, i32* %3
%18 = load volatile i32, i32* %3
%19 = icmp eq i32 %18, -2147483648
br i1 %19, label %21, label %20
20: ; preds = %14
tail call void @abort()
unreachable
21: ; preds = %14
%22 = bitcast i64* %4 to i8*
store volatile i64 -9223372036854775808, i64* %4
%23 = load volatile i64, i64* %4
%24 = sub i64 0, %23
store volatile i64 %24, i64* %4
%25 = load volatile i64, i64* %4
%26 = icmp eq i64 %25, -9223372036854775808
br i1 %26, label %28, label %27
27: ; preds = %21
tail call void @abort()
unreachable
28: ; preds = %21
%29 = bitcast i64* %5 to i8*
store volatile i64 -9223372036854775808, i64* %5
%30 = load volatile i64, i64* %5
%31 = sub i64 0, %30
store volatile i64 %31, i64* %5
%32 = load volatile i64, i64* %5
%33 = icmp eq i64 %32, -9223372036854775808
br i1 %33, label %35, label %34
34: ; preds = %28
tail call void @abort()
unreachable
35: ; preds = %28
ret i32 0
}