#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 */
scalar_t__ test__moddi3(int, int, int);
int main() {
  if (test__moddi3(0, 1, 0))
    return 1;
  if (test__moddi3(0, -1, 0))
    return 1;
  if (test__moddi3(5, 3, 2))
    return 1;
  if (test__moddi3(5, -3, 2))
    return 1;
  if (test__moddi3(-5, 3, -2))
    return 1;
  if (test__moddi3(-5, -3, -2))
    return 1;
  if (test__moddi3(0x8000000000000000LL, 1, 0x0LL))
    return 1;
  if (test__moddi3(0x8000000000000000LL, -1, 0x0LL))
    return 1;
  if (test__moddi3(0x8000000000000000LL, 2, 0x0LL))
    return 1;
  if (test__moddi3(0x8000000000000000LL, -2, 0x0LL))
    return 1;
  if (test__moddi3(0x8000000000000000LL, 3, -2))
    return 1;
  if (test__moddi3(0x8000000000000000LL, -3, -2))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     1143 <main+0x33>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
xor    %edx,%edx
mov    $0xffffffff,%esi
mov    %edx,%edi
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     1167 <main+0x57>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
mov    $0x5,%edi
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     1191 <main+0x81>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
mov    $0x5,%edi
mov    $0xfffffffd,%esi
mov    $0x2,%edx
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     11bb <main+0xab>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
mov    $0xfffffffb,%edi
mov    $0x3,%esi
mov    $0xfffffffe,%edx
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     11e5 <main+0xd5>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
mov    $0xfffffffb,%edi
mov    $0xfffffffd,%esi
mov    $0xfffffffe,%edx
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     120f <main+0xff>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     1233 <main+0x123>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
xor    %edx,%edx
mov    $0xffffffff,%esi
mov    %edx,%edi
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     1257 <main+0x147>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
xor    %edx,%edx
mov    $0x2,%esi
mov    %edx,%edi
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     127b <main+0x16b>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
xor    %edx,%edx
mov    $0xfffffffe,%esi
mov    %edx,%edi
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     129f <main+0x18f>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
xor    %edi,%edi
mov    $0x3,%esi
mov    $0xfffffffe,%edx
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     12c6 <main+0x1b6>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
xor    %edi,%edi
mov    $0xfffffffd,%esi
mov    $0xfffffffe,%edx
call   1030 <test__moddi3@plt>
cmp    $0x0,%rax
je     12ed <main+0x1dd>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <main+0x1e4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%ebx
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
xor    %edi,%edi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
mov    $0x5,%edi
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
mov    $0x5,%edi
mov    $0xfffffffd,%esi
mov    $0x2,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
mov    $0xfffffffb,%edi
mov    $0x3,%esi
mov    $0xfffffffe,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
mov    $0xfffffffb,%edi
mov    $0xfffffffd,%esi
mov    $0xfffffffe,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
mov    $0x1,%ebx
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
xor    %edi,%edi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
xor    %edi,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
xor    %edi,%edi
mov    $0xfffffffe,%esi
xor    %edx,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
xor    %edi,%edi
mov    $0x3,%esi
mov    $0xfffffffe,%edx
call   1030 <test__moddi3@plt>
test   %rax,%rax
jne    1238 <main+0x128>
xor    %edi,%edi
mov    $0xfffffffd,%esi
mov    $0xfffffffe,%edx
call   1030 <test__moddi3@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @test__moddi3(i32 0, i32 1, i32 0)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 1, i32* %1
br label %50
5: ; preds = %0
%6 = call i64 @test__moddi3(i32 0, i32 -1, i32 0)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
store i32 1, i32* %1
br label %50
9: ; preds = %5
%10 = call i64 @test__moddi3(i32 5, i32 3, i32 2)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 1, i32* %1
br label %50
13: ; preds = %9
%14 = call i64 @test__moddi3(i32 5, i32 -3, i32 2)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %1
br label %50
17: ; preds = %13
%18 = call i64 @test__moddi3(i32 -5, i32 3, i32 -2)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 1, i32* %1
br label %50
21: ; preds = %17
%22 = call i64 @test__moddi3(i32 -5, i32 -3, i32 -2)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 1, i32* %1
br label %50
25: ; preds = %21
%26 = call i64 @test__moddi3(i32 0, i32 1, i32 0)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 1, i32* %1
br label %50
29: ; preds = %25
%30 = call i64 @test__moddi3(i32 0, i32 -1, i32 0)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %29
store i32 1, i32* %1
br label %50
33: ; preds = %29
%34 = call i64 @test__moddi3(i32 0, i32 2, i32 0)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %33
store i32 1, i32* %1
br label %50
37: ; preds = %33
%38 = call i64 @test__moddi3(i32 0, i32 -2, i32 0)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %37
store i32 1, i32* %1
br label %50
41: ; preds = %37
%42 = call i64 @test__moddi3(i32 0, i32 3, i32 -2)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 1, i32* %1
br label %50
45: ; preds = %41
%46 = call i64 @test__moddi3(i32 0, i32 -3, i32 -2)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %45
store i32 1, i32* %1
br label %50
49: ; preds = %45
store i32 0, i32* %1
br label %50
50: ; preds = %49, %48, %44, %40, %36, %32, %28, %24, %20, %16, %12, %8, %4
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @test__moddi3(i32 0, i32 1, i32 0)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %37
3: ; preds = %0
%4 = tail call i64 @test__moddi3(i32 0, i32 -1, i32 0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %37
6: ; preds = %3
%7 = tail call i64 @test__moddi3(i32 5, i32 3, i32 2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %37
9: ; preds = %6
%10 = tail call i64 @test__moddi3(i32 5, i32 -3, i32 2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %37
12: ; preds = %9
%13 = tail call i64 @test__moddi3(i32 -5, i32 3, i32 -2)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %37
15: ; preds = %12
%16 = tail call i64 @test__moddi3(i32 -5, i32 -3, i32 -2)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %37
18: ; preds = %15
%19 = tail call i64 @test__moddi3(i32 0, i32 1, i32 0)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %37
21: ; preds = %18
%22 = tail call i64 @test__moddi3(i32 0, i32 -1, i32 0)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %37
24: ; preds = %21
%25 = tail call i64 @test__moddi3(i32 0, i32 2, i32 0)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = tail call i64 @test__moddi3(i32 0, i32 -2, i32 0)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = tail call i64 @test__moddi3(i32 0, i32 3, i32 -2)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = tail call i64 @test__moddi3(i32 0, i32 -3, i32 -2)
%35 = icmp ne i64 %34, 0
%36 = zext i1 %35 to i32
br label %37
37: ; preds = %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
%38 = phi i32 [ 1, %0 ], [ 1, %3 ], [ 1, %6 ], [ 1, %9 ], [ 1, %12 ], [ 1, %15 ], [ 1, %18 ], [ 1, %21 ], [ 1, %24 ], [ 1, %27 ], [ 1, %30 ], [ %36, %33 ]
ret i32 %38
}