#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 divide(int, int);
int test_divide() {
  return 5 == divide(10, 2) && -5 == divide(-10, 2) && -5 == divide(10, -2) &&
         5 == divide(-10, -2) && 3 == divide(10, 3) && -3 == divide(10, -3) &&
         0 == divide(10, 0) && 0 == divide(0, 2);
}


x86 assembly (clang, -O0):
<test_divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
mov    $0x2,%esi
call   1030 <divide@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x5,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    121f <test_divide+0x10f>
mov    $0xfffffff6,%edi
mov    $0x2,%esi
call   1030 <divide@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xfffffffb,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    121f <test_divide+0x10f>
mov    $0xa,%edi
mov    $0xfffffffe,%esi
call   1030 <divide@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xfffffffb,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    121f <test_divide+0x10f>
mov    $0xfffffff6,%edi
mov    $0xfffffffe,%esi
call   1030 <divide@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x5,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    121f <test_divide+0x10f>
mov    $0xa,%edi
mov    $0x3,%esi
call   1030 <divide@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x3,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    121f <test_divide+0x10f>
mov    $0xa,%edi
mov    $0xfffffffd,%esi
call   1030 <divide@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xfffffffd,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    121f <test_divide+0x10f>
mov    $0xa,%edi
xor    %esi,%esi
call   1030 <divide@plt>
mov    %eax,%edx
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    121f <test_divide+0x10f>
xor    %edi,%edi
mov    $0x2,%esi
call   1030 <divide@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_divide>:
push   %rbx
mov    $0xa,%edi
mov    $0x2,%esi
call   1030 <divide@plt>
xor    %ebx,%ebx
cmp    $0x5,%eax
jne    11b4 <test_divide+0xa4>
mov    $0xfffffff6,%edi
mov    $0x2,%esi
call   1030 <divide@plt>
cmp    $0xfffffffb,%eax
jne    11b4 <test_divide+0xa4>
mov    $0xa,%edi
mov    $0xfffffffe,%esi
call   1030 <divide@plt>
cmp    $0xfffffffb,%eax
jne    11b4 <test_divide+0xa4>
mov    $0xfffffff6,%edi
mov    $0xfffffffe,%esi
call   1030 <divide@plt>
cmp    $0x5,%eax
jne    11b4 <test_divide+0xa4>
mov    $0xa,%edi
mov    $0x3,%esi
call   1030 <divide@plt>
cmp    $0x3,%eax
jne    11b4 <test_divide+0xa4>
mov    $0xa,%edi
mov    $0xfffffffd,%esi
call   1030 <divide@plt>
cmp    $0xfffffffd,%eax
jne    11b4 <test_divide+0xa4>
xor    %ebx,%ebx
mov    $0xa,%edi
xor    %esi,%esi
call   1030 <divide@plt>
test   %eax,%eax
jne    11b4 <test_divide+0xa4>
xor    %edi,%edi
mov    $0x2,%esi
call   1030 <divide@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_divide() {
%1 = call i32 @divide(i32 10, i32 2)
%2 = icmp eq i32 5, %1
br i1 %2, label %3, label %24
3: ; preds = %0
%4 = call i32 @divide(i32 -10, i32 2)
%5 = icmp eq i32 -5, %4
br i1 %5, label %6, label %24
6: ; preds = %3
%7 = call i32 @divide(i32 10, i32 -2)
%8 = icmp eq i32 -5, %7
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = call i32 @divide(i32 -10, i32 -2)
%11 = icmp eq i32 5, %10
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = call i32 @divide(i32 10, i32 3)
%14 = icmp eq i32 3, %13
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = call i32 @divide(i32 10, i32 -3)
%17 = icmp eq i32 -3, %16
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = call i32 @divide(i32 10, i32 0)
%20 = icmp eq i32 0, %19
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 @divide(i32 0, i32 2)
%23 = icmp eq i32 0, %22
br label %24
24: ; preds = %21, %18, %15, %12, %9, %6, %3, %0
%25 = phi i1 [ false, %18 ], [ false, %15 ], [ false, %12 ], [ false, %9 ], [ false, %6 ], [ false, %3 ], [ false, %0 ], [ %23, %21 ]
%26 = zext i1 %25 to i32
ret i32 %26
}

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