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


x86 assembly (clang, -O0):
<Act_ModF>:
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,%edi
call   1060 <GetFlag@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11b3 <Act_ModF+0x53>
mov    $0x0,%al
call   1080 <Me@plt>
mov    %eax,%edi
lea    0xe63(%rip),%rsi
call   1040 <SendItem@plt>
lea    0xe72(%rip),%rdi
call   1050 <Log@plt>
jmp    11cf <Act_ModF+0x6f>
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_ModF>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <ArgNum@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <ArgNum@plt>
mov    %eax,%edi
call   1060 <GetFlag@plt>
test   %eax,%eax
je     1199 <Act_ModF+0x39>
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    0xe59(%rip),%rsi
mov    %eax,%edi
call   1040 <SendItem@plt>
lea    0xe66(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <Log@plt>

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

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