#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 make_ti(int, int /*<<< orphan*/);
scalar_t__ test__divti3(int, int, int);
int main() {
  if (test__divti3(0, 1, 0))
    return 1;
  if (test__divti3(0, -1, 0))
    return 1;
  if (test__divti3(2, 1, 2))
    return 1;
  if (test__divti3(2, -1, -2))
    return 1;
  if (test__divti3(-2, 1, -2))
    return 1;
  if (test__divti3(-2, -1, 2))
    return 1;
  if (test__divti3(make_ti(0x8000000000000000LL, 0), 1,
                   make_ti(0x8000000000000000LL, 0)))
    return 1;
  if (test__divti3(make_ti(0x8000000000000000LL, 0), -1,
                   make_ti(0x8000000000000000LL, 0)))
    return 1;
  if (test__divti3(make_ti(0x8000000000000000LL, 0), -2,
                   make_ti(0x4000000000000000LL, 0)))
    return 1;
  if (test__divti3(make_ti(0x8000000000000000LL, 0), 2,
                   make_ti(0xC000000000000000LL, 0)))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     1153 <main+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
xor    %edx,%edx
mov    $0xffffffff,%esi
mov    %edx,%edi
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     1177 <main+0x57>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
mov    $0x2,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     119e <main+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
mov    $0x2,%edi
mov    $0xffffffff,%esi
mov    $0xfffffffe,%edx
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     11c8 <main+0xa8>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
mov    $0xfffffffe,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     11ef <main+0xcf>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
mov    $0xfffffffe,%edi
mov    $0xffffffff,%esi
mov    $0x2,%edx
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     1219 <main+0xf9>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_ti@plt>
mov    %eax,-0x8(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_ti@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%edx
mov    $0x1,%esi
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     1253 <main+0x133>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_ti@plt>
mov    %eax,-0xc(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_ti@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%edx
mov    $0xffffffff,%esi
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     128d <main+0x16d>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_ti@plt>
mov    %eax,-0x10(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_ti@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%edx
mov    $0xfffffffe,%esi
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     12c7 <main+0x1a7>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_ti@plt>
mov    %eax,-0x14(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_ti@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%edx
mov    $0x2,%esi
call   1030 <test__divti3@plt>
cmp    $0x0,%rax
je     1301 <main+0x1e1>
movl   $0x1,-0x4(%rbp)
jmp    1308 <main+0x1e8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebx
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
xor    %edi,%edi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
mov    $0x1,%ebx
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
mov    $0x2,%edi
mov    $0xffffffff,%esi
mov    $0xfffffffe,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
mov    $0x1,%ebx
mov    $0xfffffffe,%edi
mov    $0x1,%esi
mov    $0xfffffffe,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
mov    $0xfffffffe,%edi
mov    $0xffffffff,%esi
mov    $0x2,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_ti@plt>
mov    %eax,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_ti@plt>
mov    $0x1,%ebx
mov    %ebp,%edi
mov    $0x1,%esi
mov    %eax,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_ti@plt>
mov    %eax,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_ti@plt>
mov    %ebp,%edi
mov    $0xffffffff,%esi
mov    %eax,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_ti@plt>
mov    %eax,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_ti@plt>
mov    %ebp,%edi
mov    $0xfffffffe,%esi
mov    %eax,%edx
call   1030 <test__divti3@plt>
test   %rax,%rax
jne    1278 <main+0x158>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_ti@plt>
mov    %eax,%ebx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_ti@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %eax,%edx
call   1030 <test__divti3@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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