#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_Div(void) {
  int a = ArgNum();
  int b = 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_Div>:
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_Div+0x4c>
lea    0xe73(%rip),%rdi
call   1050 <Log@plt>
mov    $0x0,%al
call   1080 <Me@plt>
mov    %eax,%edi
lea    0xe6f(%rip),%rsi
call   1040 <SendItem@plt>
jmp    11c8 <Act_Div+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    %eax,%esi
call   1030 <SetFlag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Act_Div>:
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_Div+0x32>
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    0xe67(%rip),%rdi
call   1050 <Log@plt>
xor    %eax,%eax
call   1080 <Me@plt>
lea    0xe65(%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_Div() {
%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 @Log(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @Me()
%10 = call i32 @SendItem(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 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 = sdiv i32 %14, %15
%17 = call i32 @SetFlag(i32 %12, i32 %16)
br label %18
18: ; preds = %11, %7
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_Div() {
%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 @Log(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @Me()
%7 = tail call i32 @SendItem(i32 %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %12
8: ; preds = %0
%9 = tail call i32 @GetFlag(i32 %1)
%10 = sdiv i32 %9, %2
%11 = tail call i32 @SetFlag(i32 %1, i32 %10)
br label %12
12: ; preds = %8, %4
ret void
}