#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_tu(int, int);
scalar_t__ test__udivti3(int, int, int);
int main() {
  if (test__udivti3(0, 1, 0))
    return 1;
  if (test__udivti3(2, 1, 2))
    return 1;
  if (test__udivti3(make_tu(0x8000000000000000uLL, 0), 1,
                    make_tu(0x8000000000000000uLL, 0)))
    return 1;
  if (test__udivti3(make_tu(0x8000000000000000uLL, 0), 2,
                    make_tu(0x4000000000000000uLL, 0)))
    return 1;
  if (test__udivti3(make_tu(0xFFFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL), 2,
                    make_tu(0x7FFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL)))
    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__udivti3@plt>
cmp    $0x0,%rax
je     1153 <main+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1235 <main+0x115>
mov    $0x2,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <test__udivti3@plt>
cmp    $0x0,%rax
je     117a <main+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1235 <main+0x115>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_tu@plt>
mov    %eax,-0x8(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_tu@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%edx
mov    $0x1,%esi
call   1030 <test__udivti3@plt>
cmp    $0x0,%rax
je     11b4 <main+0x94>
movl   $0x1,-0x4(%rbp)
jmp    1235 <main+0x115>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_tu@plt>
mov    %eax,-0xc(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <make_tu@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%edx
mov    $0x2,%esi
call   1030 <test__udivti3@plt>
cmp    $0x0,%rax
je     11ee <main+0xce>
movl   $0x1,-0x4(%rbp)
jmp    1235 <main+0x115>
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1040 <make_tu@plt>
mov    %eax,-0x10(%rbp)
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1040 <make_tu@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%edx
mov    $0x2,%esi
call   1030 <test__udivti3@plt>
cmp    $0x0,%rax
je     122e <main+0x10e>
movl   $0x1,-0x4(%rbp)
jmp    1235 <main+0x115>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%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__udivti3@plt>
test   %rax,%rax
jne    11ea <main+0xca>
mov    $0x1,%ebx
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <test__udivti3@plt>
test   %rax,%rax
jne    11ea <main+0xca>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_tu@plt>
mov    %eax,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_tu@plt>
mov    $0x1,%ebx
mov    %ebp,%edi
mov    $0x1,%esi
mov    %eax,%edx
call   1030 <test__udivti3@plt>
test   %rax,%rax
jne    11ea <main+0xca>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_tu@plt>
mov    %eax,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1040 <make_tu@plt>
mov    %ebp,%edi
mov    $0x2,%esi
mov    %eax,%edx
call   1030 <test__udivti3@plt>
test   %rax,%rax
jne    11ea <main+0xca>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1040 <make_tu@plt>
mov    %eax,%ebx
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1040 <make_tu@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %eax,%edx
call   1030 <test__udivti3@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__udivti3(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 %28
5: ; preds = %0
%6 = call i64 @test__udivti3(i32 2, i32 1, i32 2)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
store i32 1, i32* %1
br label %28
9: ; preds = %5
%10 = call i32 @make_tu(i32 0, i32 0)
%11 = call i32 @make_tu(i32 0, i32 0)
%12 = call i64 @test__udivti3(i32 %10, i32 1, i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 1, i32* %1
br label %28
15: ; preds = %9
%16 = call i32 @make_tu(i32 0, i32 0)
%17 = call i32 @make_tu(i32 0, i32 0)
%18 = call i64 @test__udivti3(i32 %16, i32 2, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 1, i32* %1
br label %28
21: ; preds = %15
%22 = call i32 @make_tu(i32 -1, i32 -1)
%23 = call i32 @make_tu(i32 -1, i32 -1)
%24 = call i64 @test__udivti3(i32 %22, i32 2, i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 1, i32* %1
br label %28
27: ; preds = %21
store i32 0, i32* %1
br label %28
28: ; preds = %27, %26, %20, %14, %8, %4
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @test__udivti3(i32 0, i32 1, i32 0)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %22
3: ; preds = %0
%4 = tail call i64 @test__udivti3(i32 2, i32 1, i32 2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %22
6: ; preds = %3
%7 = tail call i32 @make_tu(i32 0, i32 0)
%8 = tail call i32 @make_tu(i32 0, i32 0)
%9 = tail call i64 @test__udivti3(i32 %7, i32 1, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %6
%12 = tail call i32 @make_tu(i32 0, i32 0)
%13 = tail call i32 @make_tu(i32 0, i32 0)
%14 = tail call i64 @test__udivti3(i32 %12, i32 2, i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %11
%17 = tail call i32 @make_tu(i32 -1, i32 -1)
%18 = tail call i32 @make_tu(i32 -1, i32 -1)
%19 = tail call i64 @test__udivti3(i32 %17, i32 2, i32 %18)
%20 = icmp ne i64 %19, 0
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %16, %11, %6, %3, %0
%23 = phi i32 [ 1, %0 ], [ 1, %3 ], [ 1, %6 ], [ 1, %11 ], [ %21, %16 ]
ret i32 %23
}