#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 ArgNum();
int GetFlag(int);
int /*<<< orphan*/ Log(char *);
int /*<<< orphan*/ Me();
int /*<<< orphan*/ SendItem(int /*<<< orphan*/, char *);
int /*<<< orphan*/ SetFlag(int, int);
void Act_Mod(void) {
  int a = ArgNum();
  int b = ArgNum();
  if (b == 0) {
    SendItem(Me(), "Division By Zero In MOD.\n");
    Log("Division By 0 In MOD.\n");
    return;
  }
  SetFlag(a, GetFlag(a) % b);
}


x86 assembly (clang, -O0):
<Act_Mod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <ArgNum@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1070 <ArgNum@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11ac <Act_Mod+0x4c>
mov    $0x0,%al
call   1080 <Me@plt>
mov    %eax,%edi
lea    0xe6a(%rip),%rsi
call   1040 <SendItem@plt>
lea    0xe78(%rip),%rdi
call   1050 <Log@plt>
jmp    11c8 <Act_Mod+0x68>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <GetFlag@plt>
mov    -0xc(%rbp),%edi
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
call   1030 <SetFlag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Act_Mod>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <ArgNum@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <ArgNum@plt>
test   %eax,%eax
je     1192 <Act_Mod+0x32>
mov    %eax,%ebp
mov    %ebx,%edi
call   1060 <GetFlag@plt>
cltd
idiv   %ebp
mov    %ebx,%edi
mov    %edx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <SetFlag@plt>
xor    %eax,%eax
call   1080 <Me@plt>
lea    0xe60(%rip),%rsi
mov    %eax,%edi
call   1040 <SendItem@plt>
lea    0xe6c(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <Log@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Division By Zero In MOD.\0A\00"
@.str.1 = [23 x i8] c"Division By 0 In MOD.\0A\00"
define void @Act_Mod() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @ArgNum()
store i32 %3, i32* %1
%4 = call i32 (...) @ArgNum()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 (...) @Me()
%9 = call i32 @SendItem(i32 %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @Log(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %18
11: ; preds = %0
%12 = load i32, i32* %1
%13 = load i32, i32* %1
%14 = call i32 @GetFlag(i32 %13)
%15 = load i32, i32* %2
%16 = srem i32 %14, %15
%17 = call i32 @SetFlag(i32 %12, i32 %16)
br label %18
18: ; preds = %11, %7
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Division By Zero In MOD.\0A\00"
@.str.1 = [23 x i8] c"Division By 0 In MOD.\0A\00"
define void @Act_Mod() {
%1 = tail call i32 (...) @ArgNum()
%2 = tail call i32 (...) @ArgNum()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = tail call i32 (...) @Me()
%6 = tail call i32 @SendItem(i32 %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @Log(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %12
8: ; preds = %0
%9 = tail call i32 @GetFlag(i32 %1)
%10 = srem i32 %9, %2
%11 = tail call i32 @SetFlag(i32 %1, i32 %10)
br label %12
12: ; preds = %8, %4
ret void
}