#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 */
struct battle_char {
  int dummy;
};

/* Variables and functions */
scalar_t__ get_random(int /*<<< orphan*/, int);
scalar_t__ mod6(struct battle_char *, struct battle_char *, int);
int /*<<< orphan*/ remove_status(struct battle_char *, int);
void dispel_magic(struct battle_char *origin, struct battle_char *target) {
  if (get_random(0, 100) < mod6(origin, target, 200)) {
    remove_status(target, 23);
    remove_status(target, 20);
    remove_status(target, 21);
    remove_status(target, 22);
    remove_status(target, 7);
    remove_status(target, 26);
    remove_status(target, 27);
    remove_status(target, 15);
    remove_status(target, 25);
  }
}


x86 assembly (clang, -O0):
<dispel_magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <get_random@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xc8,%edx
call   1040 <mod6@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jge    11f0 <dispel_magic+0xc0>
mov    -0x10(%rbp),%rdi
mov    $0x17,%esi
call   1050 <remove_status@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%esi
call   1050 <remove_status@plt>
mov    -0x10(%rbp),%rdi
mov    $0x15,%esi
call   1050 <remove_status@plt>
mov    -0x10(%rbp),%rdi
mov    $0x16,%esi
call   1050 <remove_status@plt>
mov    -0x10(%rbp),%rdi
mov    $0x7,%esi
call   1050 <remove_status@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1a,%esi
call   1050 <remove_status@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1b,%esi
call   1050 <remove_status@plt>
mov    -0x10(%rbp),%rdi
mov    $0xf,%esi
call   1050 <remove_status@plt>
mov    -0x10(%rbp),%rdi
mov    $0x19,%esi
call   1050 <remove_status@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dispel_magic>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <get_random@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xc8,%edx
call   1040 <mod6@plt>
cmp    %rax,%r15
jge    11d9 <dispel_magic+0xa9>
mov    %rbx,%rdi
mov    $0x17,%esi
call   1050 <remove_status@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <remove_status@plt>
mov    %rbx,%rdi
mov    $0x15,%esi
call   1050 <remove_status@plt>
mov    %rbx,%rdi
mov    $0x16,%esi
call   1050 <remove_status@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <remove_status@plt>
mov    %rbx,%rdi
mov    $0x1a,%esi
call   1050 <remove_status@plt>
mov    %rbx,%rdi
mov    $0x1b,%esi
call   1050 <remove_status@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <remove_status@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <remove_status@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.battle_char = type { i32 }
define void @dispel_magic(%struct.battle_char* %0, %struct.battle_char* %1) {
%3 = alloca %struct.battle_char*
%4 = alloca %struct.battle_char*
store %struct.battle_char* %0, %struct.battle_char** %3
store %struct.battle_char* %1, %struct.battle_char** %4
%5 = call i64 @get_random(i32 0, i32 100)
%6 = load %struct.battle_char*, %struct.battle_char** %3
%7 = load %struct.battle_char*, %struct.battle_char** %4
%8 = call i64 @mod6(%struct.battle_char* %6, %struct.battle_char* %7, i32 200)
%9 = icmp slt i64 %5, %8
br i1 %9, label %10, label %29
10: ; preds = %2
%11 = load %struct.battle_char*, %struct.battle_char** %4
%12 = call i32 @remove_status(%struct.battle_char* %11, i32 23)
%13 = load %struct.battle_char*, %struct.battle_char** %4
%14 = call i32 @remove_status(%struct.battle_char* %13, i32 20)
%15 = load %struct.battle_char*, %struct.battle_char** %4
%16 = call i32 @remove_status(%struct.battle_char* %15, i32 21)
%17 = load %struct.battle_char*, %struct.battle_char** %4
%18 = call i32 @remove_status(%struct.battle_char* %17, i32 22)
%19 = load %struct.battle_char*, %struct.battle_char** %4
%20 = call i32 @remove_status(%struct.battle_char* %19, i32 7)
%21 = load %struct.battle_char*, %struct.battle_char** %4
%22 = call i32 @remove_status(%struct.battle_char* %21, i32 26)
%23 = load %struct.battle_char*, %struct.battle_char** %4
%24 = call i32 @remove_status(%struct.battle_char* %23, i32 27)
%25 = load %struct.battle_char*, %struct.battle_char** %4
%26 = call i32 @remove_status(%struct.battle_char* %25, i32 15)
%27 = load %struct.battle_char*, %struct.battle_char** %4
%28 = call i32 @remove_status(%struct.battle_char* %27, i32 25)
br label %29
29: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
%struct.battle_char = type { i32 }
define void @dispel_magic(%struct.battle_char* %0, %struct.battle_char* %1) {
%3 = tail call i64 @get_random(i32 0, i32 100)
%4 = tail call i64 @mod6(%struct.battle_char* %0, %struct.battle_char* %1, i32 200)
%5 = icmp slt i64 %3, %4
br i1 %5, label %6, label %16
6: ; preds = %2
%7 = tail call i32 @remove_status(%struct.battle_char* %1, i32 23)
%8 = tail call i32 @remove_status(%struct.battle_char* %1, i32 20)
%9 = tail call i32 @remove_status(%struct.battle_char* %1, i32 21)
%10 = tail call i32 @remove_status(%struct.battle_char* %1, i32 22)
%11 = tail call i32 @remove_status(%struct.battle_char* %1, i32 7)
%12 = tail call i32 @remove_status(%struct.battle_char* %1, i32 26)
%13 = tail call i32 @remove_status(%struct.battle_char* %1, i32 27)
%14 = tail call i32 @remove_status(%struct.battle_char* %1, i32 15)
%15 = tail call i32 @remove_status(%struct.battle_char* %1, i32 25)
br label %16
16: ; preds = %6, %2
ret void
}