int ranking_setglobalreg_all(struct map_session_data *sd) {
  int i;
  if (nullpo_chk("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/Lilystar/Auriga/refs/heads/"
                 "master/src/map/ranking.c",
                 198, __FUNCTION__, (void *)(sd))) {
    return (0);
  };
  for (i = 0; i < 4; i++)
    ranking_setglobalreg(sd, i);
  return 1;
}


x86 assembly (clang, -O0):
<ranking_setglobalreg_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0xec9(%rip),%rdi
mov    $0xc6,%esi
lea    0xf4b(%rip),%rdx
mov    $0x0,%al
call   1040 <nullpo_chk@plt>
cmp    $0x0,%eax
je     115f <ranking_setglobalreg_all+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    1193 <ranking_setglobalreg_all+0x73>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    118c <ranking_setglobalreg_all+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1030 <ranking_setglobalreg@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1166 <ranking_setglobalreg_all+0x46>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ranking_setglobalreg_all>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed3(%rip),%rdi
lea    0xf5a(%rip),%rdx
xor    %ebp,%ebp
mov    $0xc6,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <nullpo_chk@plt>
test   %eax,%eax
jne    1187 <ranking_setglobalreg_all+0x67>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <ranking_setglobalreg@plt>
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <ranking_setglobalreg@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <ranking_setglobalreg@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <ranking_setglobalreg@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.map_session_data = type opaque
@.str = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Lilystar/Auriga/refs/heads/master/src/map/ranking.c\00"
@__FUNCTION__.ranking_setglobalreg_all = [25 x i8] c"ranking_setglobalreg_all\00"
define i32 @ranking_setglobalreg_all(%struct.map_session_data* %0) {
%2 = alloca i32
%3 = alloca %struct.map_session_data*
%4 = alloca i32
store %struct.map_session_data* %0, %struct.map_session_data** %3
%5 = load %struct.map_session_data*, %struct.map_session_data** %3
%6 = bitcast %struct.map_session_data* %5 to i8*
%7 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @nullpo_chk to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 198, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__FUNCTION__.ranking_setglobalreg_all, i64 0, i64 0), i8* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %22
10: ; preds = %1
store i32 0, i32* %4
br label %11
11: ; preds = %18, %10
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load %struct.map_session_data*, %struct.map_session_data** %3
%16 = load i32, i32* %4
%17 = call i32 (%struct.map_session_data*, i32, ...) bitcast (i32 (...)* @ranking_setglobalreg to i32 (%struct.map_session_data*, i32, ...)*)(%struct.map_session_data* %15, i32 %16)
br label %18
18: ; preds = %14
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %11
21: ; preds = %11
store i32 1, i32* %2
br label %22
22: ; preds = %21, %9
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
%struct.map_session_data = type opaque
@.str = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Lilystar/Auriga/refs/heads/master/src/map/ranking.c\00"
@__FUNCTION__.ranking_setglobalreg_all = [25 x i8] c"ranking_setglobalreg_all\00"
define i32 @ranking_setglobalreg_all(%struct.map_session_data* %0) {
%2 = bitcast %struct.map_session_data* %0 to i8*
%3 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @nullpo_chk to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 198, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__FUNCTION__.ranking_setglobalreg_all, i64 0, i64 0), i8* %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = tail call i32 (%struct.map_session_data*, i32, ...) bitcast (i32 (...)* @ranking_setglobalreg to i32 (%struct.map_session_data*, i32, ...)*)(%struct.map_session_data* %0, i32 0)
%7 = tail call i32 (%struct.map_session_data*, i32, ...) bitcast (i32 (...)* @ranking_setglobalreg to i32 (%struct.map_session_data*, i32, ...)*)(%struct.map_session_data* %0, i32 1)
%8 = tail call i32 (%struct.map_session_data*, i32, ...) bitcast (i32 (...)* @ranking_setglobalreg to i32 (%struct.map_session_data*, i32, ...)*)(%struct.map_session_data* %0, i32 2)
%9 = tail call i32 (%struct.map_session_data*, i32, ...) bitcast (i32 (...)* @ranking_setglobalreg to i32 (%struct.map_session_data*, i32, ...)*)(%struct.map_session_data* %0, i32 3)
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 0, %1 ], [ 1, %5 ]
ret i32 %11
}