int main() {
  volatile long long l1 = 1;
  volatile long long l2 = -1;
  volatile long long l3 = -1;
  if (((-0x7fffffffffffffffLL - 1) % 1LL) != 0)
    __builtin_abort();
  if (((-0x7fffffffffffffffLL - 1) % l1) != 0)
    __builtin_abort();
  if (l2 == -1) {
    if (((-0x7fffffffffffffffLL - 1) % 1LL) != 0)
      __builtin_abort();
  } else if (((-0x7fffffffffffffffLL - 1) % -l2) != 0)
    __builtin_abort();
  if (((-0x7fffffffffffffffLL - 1) % -l3) != 0)
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
movq   $0xffffffffffffffff,-0x18(%rbp)
ff
movq   $0xffffffffffffffff,-0x20(%rbp)
ff
mov    -0x10(%rbp),%rcx
movabs $0x8000000000000000,%rax
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     1159 <main+0x49>
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
cmp    $0xffffffffffffffff,%rax
jne    116c <main+0x5c>
jmp    1198 <main+0x88>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    %rax,%rcx
movabs $0x8000000000000000,%rax
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     1193 <main+0x83>
call   1030 <abort@plt>
jmp    1198 <main+0x88>
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
sub    %rax,%rcx
movabs $0x8000000000000000,%rax
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     11bf <main+0xaf>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movq   $0x1,0x10(%rsp)
movq   $0xffffffffffffffff,(%rsp)
ff
movq   $0xffffffffffffffff,0x8(%rsp)
ff ff
movabs $0x8000000000000000,%rax
cqto
idivq  0x10(%rsp)
test   %rdx,%rdx
jne    118a <main+0x7a>
mov    (%rsp),%rax
cmp    $0xffffffffffffffff,%rax
je     1168 <main+0x58>
xor    %ecx,%ecx
sub    (%rsp),%rcx
movabs $0x8000000000000000,%rax
cqto
idiv   %rcx
test   %rdx,%rdx
jne    118a <main+0x7a>
xor    %ecx,%ecx
sub    0x8(%rsp),%rcx
movabs $0x8000000000000000,%rax
cqto
idiv   %rcx
test   %rdx,%rdx
jne    118a <main+0x7a>
xor    %eax,%eax
add    $0x18,%rsp
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store volatile i64 1, i64* %2
store volatile i64 -1, i64* %3
store volatile i64 -1, i64* %4
%5 = load volatile i64, i64* %2
%6 = srem i64 -9223372036854775808, %5
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
unreachable
9: ; preds = %0
%10 = load volatile i64, i64* %3
%11 = icmp eq i64 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %9
br label %20
13: ; preds = %9
%14 = load volatile i64, i64* %3
%15 = sub nsw i64 0, %14
%16 = srem i64 -9223372036854775808, %15
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
unreachable
19: ; preds = %13
br label %20
20: ; preds = %19, %12
%21 = load volatile i64, i64* %4
%22 = sub nsw i64 0, %21
%23 = srem i64 -9223372036854775808, %22
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
unreachable
26: ; preds = %20
ret i32 0
}

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