#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*/ _longadd(unsigned int *, unsigned int *);
int /*<<< orphan*/ _longsplit(unsigned int, unsigned int *, unsigned int *);
char _longmul(unsigned *f1, unsigned *f2) {
  unsigned f1h, f1l, f2h, f2l;
  _longsplit(*f1, &f1l, &f1h);
  _longsplit(*f2, &f2l, &f2h);
  *f1 = f1l * f2l;
  *f2 = f1h * f2h;
  f1l *= f2h;
  f2l *= f1h;
  _longadd(&f1l, &f2l);
  _longsplit(f1l, &f1l, &f1h);
  f1l <<= (sizeof(unsigned) * 4);
  _longadd(f1, &f1l);
  *f2 += f1l + (f2l << (sizeof(unsigned) * 4)) + f1h;
  return *f2 == 0;
}


x86 assembly (clang, -O0):
<_longmul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <_longsplit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <_longsplit@plt>
mov    -0x18(%rbp),%ecx
imul   -0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <_longadd@plt>
mov    -0x18(%rbp),%edi
lea    -0x18(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <_longsplit@plt>
mov    -0x18(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <_longadd@plt>
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%eax
shl    $0x10,%eax
add    %eax,%ecx
add    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_longmul>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%edi
mov    %rsp,%r15
lea    0x8(%rsp),%r12
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <_longsplit@plt>
mov    (%r14),%edi
lea    0x4(%rsp),%r13
lea    0xc(%rsp),%rdx
mov    %r13,%rsi
call   1030 <_longsplit@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
mov    %ecx,%edx
imul   %eax,%edx
mov    %edx,(%rbx)
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%esi
mov    %esi,%edi
imul   %edx,%edi
mov    %edi,(%r14)
imul   %eax,%esi
mov    %esi,(%rsp)
imul   %ecx,%edx
mov    %edx,0x4(%rsp)
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <_longadd@plt>
mov    (%rsp),%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <_longsplit@plt>
shll   $0x10,(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <_longadd@plt>
mov    0x4(%rsp),%eax
shl    $0x10,%eax
add    (%rsp),%eax
add    0x8(%rsp),%eax
add    %eax,(%r14)
sete   %al
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define signext i8 @_longmul(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = call i32 @_longsplit(i32 %10, i32* %6, i32* %5)
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = call i32 @_longsplit(i32 %13, i32* %8, i32* %7)
%15 = load i32, i32* %6
%16 = load i32, i32* %8
%17 = mul i32 %15, %16
%18 = load i32*, i32** %3
store i32 %17, i32* %18
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = mul i32 %19, %20
%22 = load i32*, i32** %4
store i32 %21, i32* %22
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = mul i32 %24, %23
store i32 %25, i32* %6
%26 = load i32, i32* %5
%27 = load i32, i32* %8
%28 = mul i32 %27, %26
store i32 %28, i32* %8
%29 = call i32 @_longadd(i32* %6, i32* %8)
%30 = load i32, i32* %6
%31 = call i32 @_longsplit(i32 %30, i32* %6, i32* %5)
%32 = load i32, i32* %6
%33 = shl i32 %32, 16
store i32 %33, i32* %6
%34 = load i32*, i32** %3
%35 = call i32 @_longadd(i32* %34, i32* %6)
%36 = load i32, i32* %6
%37 = load i32, i32* %8
%38 = shl i32 %37, 16
%39 = add i32 %36, %38
%40 = load i32, i32* %5
%41 = add i32 %39, %40
%42 = load i32*, i32** %4
%43 = load i32, i32* %42
%44 = add i32 %43, %41
store i32 %44, i32* %42
%45 = load i32*, i32** %4
%46 = load i32, i32* %45
%47 = icmp eq i32 %46, 0
%48 = zext i1 %47 to i32
%49 = trunc i32 %48 to i8
ret i8 %49
}

LLVM IR (-O2):
define signext i8 @_longmul(i32* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = load i32, i32* %0
%12 = call i32 @_longsplit(i32 %11, i32* %4, i32* %3)
%13 = load i32, i32* %1
%14 = call i32 @_longsplit(i32 %13, i32* %6, i32* %5)
%15 = load i32, i32* %4
%16 = load i32, i32* %6
%17 = mul i32 %16, %15
store i32 %17, i32* %0
%18 = load i32, i32* %3
%19 = load i32, i32* %5
%20 = mul i32 %19, %18
store i32 %20, i32* %1
%21 = mul i32 %19, %15
store i32 %21, i32* %4
%22 = mul i32 %18, %16
store i32 %22, i32* %6
%23 = call i32 @_longadd(i32* %4, i32* %6)
%24 = load i32, i32* %4
%25 = call i32 @_longsplit(i32 %24, i32* %4, i32* %3)
%26 = load i32, i32* %4
%27 = shl i32 %26, 16
store i32 %27, i32* %4
%28 = call i32 @_longadd(i32* %0, i32* %4)
%29 = load i32, i32* %4
%30 = load i32, i32* %6
%31 = shl i32 %30, 16
%32 = add i32 %31, %29
%33 = load i32, i32* %3
%34 = add i32 %32, %33
%35 = load i32, i32* %1
%36 = add i32 %34, %35
store i32 %36, i32* %1
%37 = icmp eq i32 %36, 0
%38 = zext i1 %37 to i8
ret i8 %38
}