int mob_class_change_randam(struct mob_data *md, unsigned short lv) {
  int class_;
  if (nullpo_chk("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/AurigaProject/root/refs/"
                 "heads/master/src/map/mob.c",
                 2578, __FUNCTION__, (void *)(md))) {
    return (0);
  };
  class_ = mobdb_searchrandomid(1, lv);
  return mob_class_change_id(md, class_);
}


x86 assembly (clang, -O0):
<mob_class_change_randam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rcx
lea    0xeb2(%rip),%rdi
mov    $0xa12,%esi
lea    0xf33(%rip),%rdx
mov    $0x0,%al
call   1040 <nullpo_chk@plt>
cmp    $0x0,%eax
je     1176 <mob_class_change_randam+0x46>
movl   $0x0,-0x4(%rbp)
jmp    119a <mob_class_change_randam+0x6a>
movzwl -0x12(%rbp),%esi
mov    $0x1,%edi
mov    $0x0,%al
call   1050 <mobdb_searchrandomid@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    $0x0,%al
call   1030 <mob_class_change_id@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mob_class_change_randam>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xec1(%rip),%rdi
lea    0xf47(%rip),%rdx
mov    $0xa12,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <nullpo_chk@plt>
test   %eax,%eax
je     1162 <mob_class_change_randam+0x32>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
movzwl %bp,%esi
mov    $0x1,%edi
xor    %eax,%eax
call   1050 <mobdb_searchrandomid@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <mob_class_change_id@plt>

LLVM IR (-O0):
%struct.mob_data = type opaque
@.str = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AurigaProject/root/refs/heads/master/src/map/mob.c\00"
@__FUNCTION__.mob_class_change_randam = [24 x i8] c"mob_class_change_randam\00"
define i32 @mob_class_change_randam(%struct.mob_data* %0, i16 zeroext %1) {
%3 = alloca i32
%4 = alloca %struct.mob_data*
%5 = alloca i16
%6 = alloca i32
store %struct.mob_data* %0, %struct.mob_data** %4
store i16 %1, i16* %5
%7 = load %struct.mob_data*, %struct.mob_data** %4
%8 = bitcast %struct.mob_data* %7 to i8*
%9 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @nullpo_chk to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0), i32 2578, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @__FUNCTION__.mob_class_change_randam, i64 0, i64 0), i8* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %19
12: ; preds = %2
%13 = load i16, i16* %5
%14 = zext i16 %13 to i32
%15 = call i32 (i32, i32, ...) bitcast (i32 (...)* @mobdb_searchrandomid to i32 (i32, i32, ...)*)(i32 1, i32 %14)
store i32 %15, i32* %6
%16 = load %struct.mob_data*, %struct.mob_data** %4
%17 = load i32, i32* %6
%18 = call i32 (%struct.mob_data*, i32, ...) bitcast (i32 (...)* @mob_class_change_id to i32 (%struct.mob_data*, i32, ...)*)(%struct.mob_data* %16, i32 %17)
store i32 %18, i32* %3
br label %19
19: ; preds = %12, %11
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
%struct.mob_data = type opaque
@.str = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AurigaProject/root/refs/heads/master/src/map/mob.c\00"
@__FUNCTION__.mob_class_change_randam = [24 x i8] c"mob_class_change_randam\00"
define i32 @mob_class_change_randam(%struct.mob_data* %0, i16 zeroext %1) {
%3 = bitcast %struct.mob_data* %0 to i8*
%4 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @nullpo_chk to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0), i32 2578, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @__FUNCTION__.mob_class_change_randam, i64 0, i64 0), i8* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = zext i16 %1 to i32
%8 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @mobdb_searchrandomid to i32 (i32, i32, ...)*)(i32 1, i32 %7)
%9 = tail call i32 (%struct.mob_data*, i32, ...) bitcast (i32 (...)* @mob_class_change_id to i32 (%struct.mob_data*, i32, ...)*)(%struct.mob_data* %0, i32 %8)
br label %10
10: ; preds = %2, %6
%11 = phi i32 [ %9, %6 ], [ 0, %2 ]
ret i32 %11
}