#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 /*<<< orphan*/ _expect_int_eq(int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ az_modulo(int, int);
void test_modulo(void) {
  _expect_int_eq(3, az_modulo(10, 7),
                 "3"
                 " == "
                 "az_modulo(10, 7)");
  _expect_int_eq(4, az_modulo(-10, 7),
                 "4"
                 " == "
                 "az_modulo(-10, 7)");
  _expect_int_eq(-4, az_modulo(10, -7),
                 "-4"
                 " == "
                 "az_modulo(10, -7)");
  _expect_int_eq(-3, az_modulo(-10, -7),
                 "-3"
                 " == "
                 "az_modulo(-10, -7)");
  _expect_int_eq(0, az_modulo(0, 7),
                 "0"
                 " == "
                 "az_modulo(0, 7)");
  _expect_int_eq(0, az_modulo(0, -7),
                 "0"
                 " == "
                 "az_modulo(0, -7)");
  _expect_int_eq(0, az_modulo(14, 7),
                 "0"
                 " == "
                 "az_modulo(14, 7)");
  _expect_int_eq(0, az_modulo(14, -7),
                 "0"
                 " == "
                 "az_modulo(14, -7)");
  _expect_int_eq(0, az_modulo(-14, 7),
                 "0"
                 " == "
                 "az_modulo(-14, 7)");
  _expect_int_eq(0, az_modulo(-14, -7),
                 "0"
                 " == "
                 "az_modulo(-14, -7)");
}


x86 assembly (clang, -O0):
<test_modulo>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
mov    $0x3,%edi
lea    0xebf(%rip),%rdx
call   1040 <_expect_int_eq@plt>
mov    $0xfffffff6,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
mov    $0x4,%edi
lea    0xeb3(%rip),%rdx
call   1040 <_expect_int_eq@plt>
mov    $0xa,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
mov    $0xfffffffc,%edi
lea    0xea8(%rip),%rdx
call   1040 <_expect_int_eq@plt>
mov    $0xfffffff6,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
mov    $0xfffffffd,%edi
lea    0xe9e(%rip),%rdx
call   1040 <_expect_int_eq@plt>
xor    %edi,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe9b(%rip),%rdx
call   1040 <_expect_int_eq@plt>
xor    %edi,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe94(%rip),%rdx
call   1040 <_expect_int_eq@plt>
mov    $0xe,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe8b(%rip),%rdx
call   1040 <_expect_int_eq@plt>
mov    $0xe,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe82(%rip),%rdx
call   1040 <_expect_int_eq@plt>
mov    $0xfffffff2,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe7a(%rip),%rdx
call   1040 <_expect_int_eq@plt>
mov    $0xfffffff2,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe72(%rip),%rdx
call   1040 <_expect_int_eq@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_modulo>:
push   %rax
mov    $0xa,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
lea    0xec9(%rip),%rdx
mov    $0x3,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
mov    $0xfffffff6,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
lea    0xebd(%rip),%rdx
mov    $0x4,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
mov    $0xa,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
lea    0xeb2(%rip),%rdx
mov    $0xfffffffc,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
mov    $0xfffffff6,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
lea    0xea8(%rip),%rdx
mov    $0xfffffffd,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
xor    %edi,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
lea    0xea2(%rip),%rdx
xor    %edi,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
xor    %edi,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
lea    0xe9b(%rip),%rdx
xor    %edi,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
mov    $0xe,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
lea    0xe92(%rip),%rdx
xor    %edi,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
mov    $0xe,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
lea    0xe89(%rip),%rdx
xor    %edi,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
mov    $0xfffffff2,%edi
mov    $0x7,%esi
call   1030 <az_modulo@plt>
lea    0xe81(%rip),%rdx
xor    %edi,%edi
mov    %eax,%esi
call   1040 <_expect_int_eq@plt>
mov    $0xfffffff2,%edi
mov    $0xfffffff9,%esi
call   1030 <az_modulo@plt>
lea    0xe79(%rip),%rdx
xor    %edi,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <_expect_int_eq@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"3 == az_modulo(10, 7)\00"
@.str.1 = [23 x i8] c"4 == az_modulo(-10, 7)\00"
@.str.2 = [24 x i8] c"-4 == az_modulo(10, -7)\00"
@.str.3 = [25 x i8] c"-3 == az_modulo(-10, -7)\00"
@.str.4 = [21 x i8] c"0 == az_modulo(0, 7)\00"
@.str.5 = [22 x i8] c"0 == az_modulo(0, -7)\00"
@.str.6 = [22 x i8] c"0 == az_modulo(14, 7)\00"
@.str.7 = [23 x i8] c"0 == az_modulo(14, -7)\00"
@.str.8 = [23 x i8] c"0 == az_modulo(-14, 7)\00"
@.str.9 = [24 x i8] c"0 == az_modulo(-14, -7)\00"
define void @test_modulo() {
%1 = call i32 @az_modulo(i32 10, i32 7)
%2 = call i32 @_expect_int_eq(i32 3, i32 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @az_modulo(i32 -10, i32 7)
%4 = call i32 @_expect_int_eq(i32 4, i32 %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @az_modulo(i32 10, i32 -7)
%6 = call i32 @_expect_int_eq(i32 -4, i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @az_modulo(i32 -10, i32 -7)
%8 = call i32 @_expect_int_eq(i32 -3, i32 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @az_modulo(i32 0, i32 7)
%10 = call i32 @_expect_int_eq(i32 0, i32 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @az_modulo(i32 0, i32 -7)
%12 = call i32 @_expect_int_eq(i32 0, i32 %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @az_modulo(i32 14, i32 7)
%14 = call i32 @_expect_int_eq(i32 0, i32 %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @az_modulo(i32 14, i32 -7)
%16 = call i32 @_expect_int_eq(i32 0, i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @az_modulo(i32 -14, i32 7)
%18 = call i32 @_expect_int_eq(i32 0, i32 %17, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 @az_modulo(i32 -14, i32 -7)
%20 = call i32 @_expect_int_eq(i32 0, i32 %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"3 == az_modulo(10, 7)\00"
@.str.1 = [23 x i8] c"4 == az_modulo(-10, 7)\00"
@.str.2 = [24 x i8] c"-4 == az_modulo(10, -7)\00"
@.str.3 = [25 x i8] c"-3 == az_modulo(-10, -7)\00"
@.str.4 = [21 x i8] c"0 == az_modulo(0, 7)\00"
@.str.5 = [22 x i8] c"0 == az_modulo(0, -7)\00"
@.str.6 = [22 x i8] c"0 == az_modulo(14, 7)\00"
@.str.7 = [23 x i8] c"0 == az_modulo(14, -7)\00"
@.str.8 = [23 x i8] c"0 == az_modulo(-14, 7)\00"
@.str.9 = [24 x i8] c"0 == az_modulo(-14, -7)\00"
define void @test_modulo() {
%1 = tail call i32 @az_modulo(i32 10, i32 7)
%2 = tail call i32 @_expect_int_eq(i32 3, i32 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @az_modulo(i32 -10, i32 7)
%4 = tail call i32 @_expect_int_eq(i32 4, i32 %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @az_modulo(i32 10, i32 -7)
%6 = tail call i32 @_expect_int_eq(i32 -4, i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @az_modulo(i32 -10, i32 -7)
%8 = tail call i32 @_expect_int_eq(i32 -3, i32 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @az_modulo(i32 0, i32 7)
%10 = tail call i32 @_expect_int_eq(i32 0, i32 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @az_modulo(i32 0, i32 -7)
%12 = tail call i32 @_expect_int_eq(i32 0, i32 %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%13 = tail call i32 @az_modulo(i32 14, i32 7)
%14 = tail call i32 @_expect_int_eq(i32 0, i32 %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 @az_modulo(i32 14, i32 -7)
%16 = tail call i32 @_expect_int_eq(i32 0, i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%17 = tail call i32 @az_modulo(i32 -14, i32 7)
%18 = tail call i32 @_expect_int_eq(i32 0, i32 %17, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%19 = tail call i32 @az_modulo(i32 -14, i32 -7)
%20 = tail call i32 @_expect_int_eq(i32 0, i32 %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
ret void
}