#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*/ Add(unsigned int *, unsigned int *);
scalar_t__ Compare(unsigned int *, unsigned int *);
int /*<<< orphan*/ Copy(unsigned int *, unsigned int *);
int /*<<< orphan*/ LongMul(unsigned int *, unsigned int *);
int DivCheck(unsigned a[], unsigned b[], unsigned quot[], unsigned res[]) {
  unsigned c[500];
  Copy(b, c);
  LongMul(c, quot);
  Add(c, res);
  if (Compare(a, c) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<DivCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x800(%rbp),%rsi
call   1030 <Copy@plt>
lea    -0x800(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <LongMul@plt>
lea    -0x800(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <Add@plt>
mov    -0x10(%rbp),%rdi
lea    -0x800(%rbp),%rsi
call   1050 <Compare@plt>
cmp    $0x0,%rax
jne    11b1 <DivCheck+0x71>
movl   $0x1,-0x4(%rbp)
jmp    11b8 <DivCheck+0x78>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DivCheck>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x7d8,%rsp
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rdi,%r15
mov    %rsp,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <Copy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <LongMul@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <Add@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <Compare@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x7d8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @DivCheck(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca [500 x i32]
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%11 = load i32*, i32** %7
%12 = getelementptr inbounds [500 x i32], [500 x i32]* %10, i64 0, i64 0
%13 = call i32 @Copy(i32* %11, i32* %12)
%14 = getelementptr inbounds [500 x i32], [500 x i32]* %10, i64 0, i64 0
%15 = load i32*, i32** %8
%16 = call i32 @LongMul(i32* %14, i32* %15)
%17 = getelementptr inbounds [500 x i32], [500 x i32]* %10, i64 0, i64 0
%18 = load i32*, i32** %9
%19 = call i32 @Add(i32* %17, i32* %18)
%20 = load i32*, i32** %6
%21 = getelementptr inbounds [500 x i32], [500 x i32]* %10, i64 0, i64 0
%22 = call i64 @Compare(i32* %20, i32* %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %4
store i32 1, i32* %5
br label %26
25: ; preds = %4
store i32 0, i32* %5
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @DivCheck(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca [500 x i32]
%6 = bitcast [500 x i32]* %5 to i8*
%7 = getelementptr inbounds [500 x i32], [500 x i32]* %5, i64 0, i64 0
%8 = call i32 @Copy(i32* %1, i32* %7)
%9 = call i32 @LongMul(i32* %7, i32* %2)
%10 = call i32 @Add(i32* %7, i32* %3)
%11 = call i64 @Compare(i32* %0, i32* %7)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}