#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*/ assert(int);
int mult_variants(int, int);
int /*<<< orphan*/ verify_mult_negations(int, int, int);
int main() {
  verify_mult_negations(17, 19, 323);
  verify_mult_negations(77773, 99991, 7776600043);
  verify_mult_negations(12207031, 305175781, 3725290219116211);
  assert(mult_variants(-0x80000000, 0x7FFFFFFF) == -0x3FFFFFFF80000000);
  assert(mult_variants(-0x80000000, -0x7FFFFFFF) == 0x3FFFFFFF80000000);
  assert(mult_variants(-0x80000000, -0x80000000) == 0x4000000000000000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x11,%edi
mov    $0x13,%esi
mov    $0x143,%edx
call   1050 <verify_mult_negations@plt>
mov    $0x12fcd,%edi
mov    $0x18697,%esi
mov    $0xcf857feb,%edx
call   1050 <verify_mult_negations@plt>
mov    $0xba43b7,%edi
mov    $0x12309ce5,%esi
mov    $0xb83216b3,%edx
call   1050 <verify_mult_negations@plt>
mov    $0x80000000,%edi
mov    $0x7fffffff,%esi
call   1030 <mult_variants@plt>
cltq
movabs $0xc000000080000000,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x80000000,%edi
mov    $0x80000001,%esi
call   1030 <mult_variants@plt>
cltq
movabs $0x3fffffff80000000,%rcx
ff ff 3f
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x80000000,%esi
mov    %esi,%edi
call   1030 <mult_variants@plt>
cltq
movabs $0x4000000000000000,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x11,%edi
mov    $0x13,%esi
mov    $0x143,%edx
call   1050 <verify_mult_negations@plt>
mov    $0x12fcd,%edi
mov    $0x18697,%esi
mov    $0xcf857feb,%edx
call   1050 <verify_mult_negations@plt>
mov    $0xba43b7,%edi
mov    $0x12309ce5,%esi
mov    $0xb83216b3,%edx
call   1050 <verify_mult_negations@plt>
mov    $0x80000000,%edi
mov    $0x7fffffff,%esi
call   1030 <mult_variants@plt>
xor    %edi,%edi
call   1040 <assert@plt>
mov    $0x80000000,%edi
mov    $0x80000001,%esi
call   1030 <mult_variants@plt>
xor    %edi,%edi
call   1040 <assert@plt>
mov    $0x80000000,%edi
mov    $0x80000000,%esi
call   1030 <mult_variants@plt>
xor    %edi,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @verify_mult_negations(i32 17, i32 19, i32 323)
%3 = call i32 @verify_mult_negations(i32 77773, i32 99991, i32 -813334549)
%4 = call i32 @verify_mult_negations(i32 12207031, i32 305175781, i32 -1204676941)
%5 = call i32 @mult_variants(i32 -2147483648, i32 2147483647)
%6 = sext i32 %5 to i64
%7 = icmp eq i64 %6, -4611686016279904256
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @mult_variants(i32 -2147483648, i32 -2147483647)
%11 = sext i32 %10 to i64
%12 = icmp eq i64 %11, 4611686016279904256
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 @mult_variants(i32 -2147483648, i32 -2147483648)
%16 = sext i32 %15 to i64
%17 = icmp eq i64 %16, 4611686018427387904
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @verify_mult_negations(i32 17, i32 19, i32 323)
%2 = tail call i32 @verify_mult_negations(i32 77773, i32 99991, i32 -813334549)
%3 = tail call i32 @verify_mult_negations(i32 12207031, i32 305175781, i32 -1204676941)
%4 = tail call i32 @mult_variants(i32 -2147483648, i32 2147483647)
%5 = tail call i32 @assert(i32 0)
%6 = tail call i32 @mult_variants(i32 -2147483648, i32 -2147483647)
%7 = tail call i32 @assert(i32 0)
%8 = tail call i32 @mult_variants(i32 -2147483648, i32 -2147483648)
%9 = tail call i32 @assert(i32 0)
ret i32 0
}