#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__udivdi3(int, int, int);
int main() {
  if (test__udivdi3(0, 1, 0))
    return 1;
  if (test__udivdi3(2, 1, 2))
    return 1;
  if (test__udivdi3(0x8000000000000000uLL, 1, 0x8000000000000000uLL))
    return 1;
  if (test__udivdi3(0x8000000000000000uLL, 2, 0x4000000000000000uLL))
    return 1;
  if (test__udivdi3(0xFFFFFFFFFFFFFFFFuLL, 2, 0x7FFFFFFFFFFFFFFFuLL))
    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__udivdi3@plt>
cmp    $0x0,%rax
je     1143 <main+0x33>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <main+0xd0>
mov    $0x2,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <test__udivdi3@plt>
cmp    $0x0,%rax
je     116a <main+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <main+0xd0>
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <test__udivdi3@plt>
cmp    $0x0,%rax
je     118e <main+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <main+0xd0>
xor    %edx,%edx
mov    $0x2,%esi
mov    %edx,%edi
call   1030 <test__udivdi3@plt>
cmp    $0x0,%rax
je     11b2 <main+0xa2>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <main+0xd0>
mov    $0xffffffff,%edx
mov    $0x2,%esi
mov    %edx,%edi
call   1030 <test__udivdi3@plt>
cmp    $0x0,%rax
je     11d9 <main+0xc9>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <main+0xd0>
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__udivdi3@plt>
test   %rax,%rax
jne    118e <main+0x7e>
mov    $0x1,%ebx
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <test__udivdi3@plt>
test   %rax,%rax
jne    118e <main+0x7e>
mov    $0x1,%ebx
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <test__udivdi3@plt>
test   %rax,%rax
jne    118e <main+0x7e>
xor    %edi,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1030 <test__udivdi3@plt>
test   %rax,%rax
jne    118e <main+0x7e>
mov    $0xffffffff,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1030 <test__udivdi3@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__udivdi3(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 %22
5: ; preds = %0
%6 = call i64 @test__udivdi3(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 %22
9: ; preds = %5
%10 = call i64 @test__udivdi3(i32 0, i32 1, i32 0)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 1, i32* %1
br label %22
13: ; preds = %9
%14 = call i64 @test__udivdi3(i32 0, i32 2, i32 0)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %1
br label %22
17: ; preds = %13
%18 = call i64 @test__udivdi3(i32 -1, i32 2, i32 -1)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 1, i32* %1
br label %22
21: ; preds = %17
store i32 0, i32* %1
br label %22
22: ; preds = %21, %20, %16, %12, %8, %4
%23 = load i32, i32* %1
ret i32 %23
}

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