#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 div(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int mod(int, int);
int /*<<< orphan*/ stderr;
int main(void) {
  int a = div(-5, 3);
  int b = mod(-5, 3);
  fprintf(stderr, "-5 div 3 = %d\n", a);
  fprintf(stderr, "-5 mod 3 = %d\n", b);
  return ((a != -1) || (b != -2));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xfffffffb,%edi
mov    $0x3,%esi
call   1050 <div@plt>
mov    %eax,-0x8(%rbp)
mov    $0xfffffffb,%edi
mov    $0x3,%esi
call   1030 <mod@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe8a(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe81(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%al
cmpl   $0xffffffff,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jne    11ac <main+0x7c>
cmpl   $0xfffffffe,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0xfffffffb,%edi
mov    $0x3,%esi
call   1050 <div@plt>
mov    %eax,%ebx
mov    $0xfffffffb,%edi
mov    $0x3,%esi
call   1030 <mod@plt>
mov    %eax,%ebp
mov    0x2e83(%rip),%r14
mov    (%r14),%edi
lea    0xe99(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xe97(%rip),%rsi
mov    %ebp,%edx
call   1040 <fprintf@plt>
not    %ebx
xor    $0xfffffffe,%ebp
xor    %eax,%eax
or     %ebx,%ebp
setne  %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"-5 div 3 = %d\0A\00"
@.str.1 = [15 x i8] c"-5 mod 3 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @div(i32 -5, i32 3)
store i32 %4, i32* %2
%5 = call i32 @mod(i32 -5, i32 3)
store i32 %5, i32* %3
%6 = load i32, i32* @stderr
%7 = load i32, i32* %2
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @stderr
%10 = load i32, i32* %3
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, -1
br i1 %13, label %17, label %14
14: ; preds = %0
%15 = load i32, i32* %3
%16 = icmp ne i32 %15, -2
br label %17
17: ; preds = %14, %0
%18 = phi i1 [ true, %0 ], [ %16, %14 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"-5 div 3 = %d\0A\00"
@.str.1 = [15 x i8] c"-5 mod 3 = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @div(i32 -5, i32 3)
%2 = tail call i32 @mod(i32 -5, i32 3)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%7 = icmp ne i32 %1, -1
%8 = icmp ne i32 %2, -2
%9 = select i1 %7, i1 true, i1 %8
%10 = zext i1 %9 to i32
ret i32 %10
}