int check_hit2(int power, int level, int ac) {
  int i, k;
  k = (Rand_div(100));
  if (k < 10)
    return (k < 5);
  i = (power + (level * 3));
  if ((i > 0) && (((Rand_div(i)) + 1) > ((ac * 3) / 4)))
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<check_hit2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x64,%edi
mov    $0x0,%al
call   1030 <Rand_div@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    114e <check_hit2+0x3e>
cmpl   $0x5,-0x18(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11a0 <check_hit2+0x90>
mov    -0x8(%rbp),%eax
imul   $0x3,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1199 <check_hit2+0x89>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1030 <Rand_div@plt>
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
imul   $0x3,-0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jle    1199 <check_hit2+0x89>
movl   $0x1,-0x4(%rbp)
jmp    11a0 <check_hit2+0x90>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_hit2>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x64,%edi
xor    %eax,%eax
call   1030 <Rand_div@plt>
cmp    $0x9,%eax
jg     1138 <check_hit2+0x28>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
setl   %al
jmp    1166 <check_hit2+0x56>
lea    (%rbx,%rbx,2),%edi
add    %ebp,%edi
jle    1164 <check_hit2+0x54>
xor    %eax,%eax
call   1030 <Rand_div@plt>
lea    (%r14,%r14,2),%ecx
lea    (%r14,%r14,2),%edx
add    $0x3,%edx
test   %ecx,%ecx
cmovns %ecx,%edx
mov    %eax,%ecx
sar    $0x2,%edx
mov    $0x1,%eax
cmp    %edx,%ecx
jge    1166 <check_hit2+0x56>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_hit2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = call i32 (i32, ...) bitcast (i32 (...)* @Rand_div to i32 (i32, ...)*)(i32 100)
store i32 %10, i32* %9
%11 = load i32, i32* %9
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* %9
%15 = icmp slt i32 %14, 5
%16 = zext i1 %15 to i32
store i32 %16, i32* %4
br label %34
17: ; preds = %3
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = mul nsw i32 %19, 3
%21 = add nsw i32 %18, %20
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %17
%25 = load i32, i32* %8
%26 = call i32 (i32, ...) bitcast (i32 (...)* @Rand_div to i32 (i32, ...)*)(i32 %25)
%27 = add nsw i32 %26, 1
%28 = load i32, i32* %7
%29 = mul nsw i32 %28, 3
%30 = sdiv i32 %29, 4
%31 = icmp sgt i32 %27, %30
br i1 %31, label %32, label %33
32: ; preds = %24
store i32 1, i32* %4
br label %34
33: ; preds = %24, %17
store i32 0, i32* %4
br label %34
34: ; preds = %33, %32, %13
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
define i32 @check_hit2(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @Rand_div to i32 (i32, ...)*)(i32 100)
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = icmp slt i32 %4, 5
%8 = zext i1 %7 to i32
br label %19
9: ; preds = %3
%10 = mul nsw i32 %1, 3
%11 = add nsw i32 %10, %0
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = tail call i32 (i32, ...) bitcast (i32 (...)* @Rand_div to i32 (i32, ...)*)(i32 %11)
%15 = mul nsw i32 %2, 3
%16 = sdiv i32 %15, 4
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %19
18: ; preds = %13, %9
br label %19
19: ; preds = %13, %18, %6
%20 = phi i32 [ %8, %6 ], [ 0, %18 ], [ 1, %13 ]
ret i32 %20
}