int try_move_block(struct bogoman_map *map, int x, int y, int dx, int dy) {
  int new_x = (int)x + dx;
  int new_y = (int)y + dy;
  if (bogoman_coord_in_map(map, new_x, new_y)) {
    if (!bogoman_is_empty(map, new_x, new_y))
      return 0;
    copy_block(map, new_x, new_y, x, y);
  } else {
    bogoman_dbg_print(1,
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/gfxprim/gfxprim/refs/"
                      "heads/master/demos/bogoman/bogoman_map.c",
                      __FUNCTION__, 180,
                      "Block moved out of screen %ux%u -> %ix%i", x, y, new_x,
                      new_y);
  }
  clear_block(map, x, y);
  return 1;
}


x86 assembly (clang, -O0):
<try_move_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    $0x0,%al
call   1030 <bogoman_coord_in_map@plt>
cmp    $0x0,%eax
je     11d8 <try_move_block+0x88>
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    $0x0,%al
call   1040 <bogoman_is_empty@plt>
cmp    $0x0,%eax
jne    11bb <try_move_block+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    1232 <try_move_block+0xe2>
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x0,%al
call   1070 <copy_block@plt>
jmp    121a <try_move_block+0xca>
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    -0x24(%rbp),%r10d
mov    -0x28(%rbp),%eax
mov    $0x1,%edi
lea    0xe0d(%rip),%rsi
lea    0xe9e(%rip),%rdx
mov    $0xb4,%ecx
lea    0xea1(%rip),%r8
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1060 <bogoman_dbg_print@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1050 <clear_block@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<try_move_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%r12
add    %esi,%ebp
add    %edx,%ebx
xor    %r13d,%r13d
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <bogoman_coord_in_map@plt>
test   %eax,%eax
je     11a7 <try_move_block+0x57>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <bogoman_is_empty@plt>
test   %eax,%eax
je     11f2 <try_move_block+0xa2>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
xor    %eax,%eax
call   1070 <copy_block@plt>
jmp    11dc <try_move_block+0x8c>
sub    $0x8,%rsp
lea    0xe4e(%rip),%rsi
lea    0xedf(%rip),%rdx
lea    0xee7(%rip),%r8
mov    $0x1,%edi
mov    $0xb4,%ecx
mov    %r15d,%r9d
xor    %eax,%eax
push   %rbx
push   %rbp
push   %r14
call   1060 <bogoman_dbg_print@plt>
add    $0x20,%rsp
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <clear_block@plt>
mov    $0x1,%r13d
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.bogoman_map = type opaque
@.str = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/gfxprim/gfxprim/refs/heads/master/demos/bogoman/bogoman_map.c\00"
@__FUNCTION__.try_move_block = [15 x i8] c"try_move_block\00"
@.str.1 = [41 x i8] c"Block moved out of screen %ux%u -> %ix%i\00"
define i32 @try_move_block(%struct.bogoman_map* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca %struct.bogoman_map*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store %struct.bogoman_map* %0, %struct.bogoman_map** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%14 = load i32, i32* %8
%15 = load i32, i32* %10
%16 = add nsw i32 %14, %15
store i32 %16, i32* %12
%17 = load i32, i32* %9
%18 = load i32, i32* %11
%19 = add nsw i32 %17, %18
store i32 %19, i32* %13
%20 = load %struct.bogoman_map*, %struct.bogoman_map** %7
%21 = load i32, i32* %12
%22 = load i32, i32* %13
%23 = call i32 (%struct.bogoman_map*, i32, i32, ...) bitcast (i32 (...)* @bogoman_coord_in_map to i32 (%struct.bogoman_map*, i32, i32, ...)*)(%struct.bogoman_map* %20, i32 %21, i32 %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %39
25: ; preds = %5
%26 = load %struct.bogoman_map*, %struct.bogoman_map** %7
%27 = load i32, i32* %12
%28 = load i32, i32* %13
%29 = call i32 (%struct.bogoman_map*, i32, i32, ...) bitcast (i32 (...)* @bogoman_is_empty to i32 (%struct.bogoman_map*, i32, i32, ...)*)(%struct.bogoman_map* %26, i32 %27, i32 %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %25
store i32 0, i32* %6
br label %50
32: ; preds = %25
%33 = load %struct.bogoman_map*, %struct.bogoman_map** %7
%34 = load i32, i32* %12
%35 = load i32, i32* %13
%36 = load i32, i32* %8
%37 = load i32, i32* %9
%38 = call i32 (%struct.bogoman_map*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @copy_block to i32 (%struct.bogoman_map*, i32, i32, i32, i32, ...)*)(%struct.bogoman_map* %33, i32 %34, i32 %35, i32 %36, i32 %37)
br label %45
39: ; preds = %5
%40 = load i32, i32* %8
%41 = load i32, i32* %9
%42 = load i32, i32* %12
%43 = load i32, i32* %13
%44 = call i32 (i32, i8*, i8*, i32, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @bogoman_dbg_print to i32 (i32, i8*, i8*, i32, i8*, i32, i32, i32, i32, ...)*)(i32 1, i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.try_move_block, i64 0, i64 0), i32 180, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %40, i32 %41, i32 %42, i32 %43)
br label %45
45: ; preds = %39, %32
%46 = load %struct.bogoman_map*, %struct.bogoman_map** %7
%47 = load i32, i32* %8
%48 = load i32, i32* %9
%49 = call i32 (%struct.bogoman_map*, i32, i32, ...) bitcast (i32 (...)* @clear_block to i32 (%struct.bogoman_map*, i32, i32, ...)*)(%struct.bogoman_map* %46, i32 %47, i32 %48)
store i32 1, i32* %6
br label %50
50: ; preds = %45, %31
%51 = load i32, i32* %6
ret i32 %51
}

LLVM IR (-O2):
%struct.bogoman_map = type opaque
@.str = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/gfxprim/gfxprim/refs/heads/master/demos/bogoman/bogoman_map.c\00"
@__FUNCTION__.try_move_block = [15 x i8] c"try_move_block\00"
@.str.1 = [41 x i8] c"Block moved out of screen %ux%u -> %ix%i\00"
define i32 @try_move_block(%struct.bogoman_map* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = add nsw i32 %3, %1
%7 = add nsw i32 %4, %2
%8 = tail call i32 (%struct.bogoman_map*, i32, i32, ...) bitcast (i32 (...)* @bogoman_coord_in_map to i32 (%struct.bogoman_map*, i32, i32, ...)*)(%struct.bogoman_map* %0, i32 %6, i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = tail call i32 (%struct.bogoman_map*, i32, i32, ...) bitcast (i32 (...)* @bogoman_is_empty to i32 (%struct.bogoman_map*, i32, i32, ...)*)(%struct.bogoman_map* %0, i32 %6, i32 %7)
%12 = icmp eq i32 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %10
%14 = tail call i32 (%struct.bogoman_map*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @copy_block to i32 (%struct.bogoman_map*, i32, i32, i32, i32, ...)*)(%struct.bogoman_map* %0, i32 %6, i32 %7, i32 %1, i32 %2)
br label %17
15: ; preds = %5
%16 = tail call i32 (i32, i8*, i8*, i32, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @bogoman_dbg_print to i32 (i32, i8*, i8*, i32, i8*, i32, i32, i32, i32, ...)*)(i32 1, i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.try_move_block, i64 0, i64 0), i32 180, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %2, i32 %6, i32 %7)
br label %17
17: ; preds = %15, %13
%18 = tail call i32 (%struct.bogoman_map*, i32, i32, ...) bitcast (i32 (...)* @clear_block to i32 (%struct.bogoman_map*, i32, i32, ...)*)(%struct.bogoman_map* %0, i32 %1, i32 %2)
br label %19
19: ; preds = %10, %17
%20 = phi i32 [ 1, %17 ], [ 0, %10 ]
ret i32 %20
}