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


x86 assembly (clang, -O0):
<Act_DivF>:
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_DivF+0x53>
lea    0xe6c(%rip),%rdi
call   1050 <Log@plt>
mov    $0x0,%al
call   1080 <Me@plt>
mov    %eax,%edi
lea    0xe68(%rip),%rsi
call   1040 <SendItem@plt>
jmp    11cf <Act_DivF+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    %eax,%esi
call   1030 <SetFlag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Act_DivF>:
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_DivF+0x39>
mov    %eax,%ebp
mov    %ebx,%edi
call   1060 <GetFlag@plt>
cltd
idiv   %ebp
mov    %ebx,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <SetFlag@plt>
lea    0xe60(%rip),%rdi
call   1050 <Log@plt>
xor    %eax,%eax
call   1080 <Me@plt>
lea    0xe5e(%rip),%rsi
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <SendItem@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Division By Zero\00"
@.str.1 = [19 x i8] c"Division By Zero.\0A\00"
define void @Act_DivF() {
%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 @Log(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @Me()
%11 = call i32 @SendItem(i32 %10, i8* getelementptr inbounds ([19 x i8], [19 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 = sdiv i32 %15, %16
%18 = call i32 @SetFlag(i32 %13, i32 %17)
br label %19
19: ; preds = %12, %8
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Division By Zero\00"
@.str.1 = [19 x i8] c"Division By Zero.\0A\00"
define void @Act_DivF() {
%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 @Log(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @Me()
%8 = tail call i32 @SendItem(i32 %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %13
9: ; preds = %0
%10 = tail call i32 @GetFlag(i32 %1)
%11 = sdiv i32 %10, %3
%12 = tail call i32 @SetFlag(i32 %1, i32 %11)
br label %13
13: ; preds = %9, %5
ret void
}