#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 */

/* Variables and functions */
int /*<<< orphan*/ move_is_ok(int);
int /*<<< orphan*/ my_fatal(char *, char *, int);
int move_order(int move) {
  {
    if (!(move_is_ok(move)))
      my_fatal("file \"%s\", line %d, assertion \""
               "move_is_ok(move)"
               "\" failed\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/"
               "master/move.c",
               357);
  };
  return ((move & 07777) << 3) | (move >> 12);
}


x86 assembly (clang, -O0):
<move_order>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <move_is_ok@plt>
cmp    $0x0,%eax
jne    1154 <move_order+0x34>
lea    0xebd(%rip),%rdi
lea    0xeef(%rip),%rsi
mov    $0x165,%edx
call   1040 <my_fatal@plt>
mov    -0x4(%rbp),%eax
and    $0xfff,%eax
shl    $0x3,%eax
mov    -0x4(%rbp),%ecx
sar    $0xc,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_order>:
push   %rbx
mov    %edi,%ebx
call   1030 <move_is_ok@plt>
test   %eax,%eax
jne    1144 <move_order+0x24>
lea    0xecd(%rip),%rdi
lea    0xeff(%rip),%rsi
mov    $0x165,%edx
call   1040 <my_fatal@plt>
lea    0x0(,%rbx,8),%eax
and    $0x7ff8,%eax
sar    $0xc,%ebx
or     %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [57 x i8] c"file \22%s\22, line %d, assertion \22move_is_ok(move)\22 failed\0A\00"
@.str.1 = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/move.c\00"
define i32 @move_order(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @move_is_ok(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @my_fatal(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.1, i64 0, i64 0), i32 357)
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = and i32 %9, 4095
%11 = shl i32 %10, 3
%12 = load i32, i32* %2
%13 = ashr i32 %12, 12
%14 = or i32 %11, %13
ret i32 %14
}

LLVM IR (-O2):
@.str = [57 x i8] c"file \22%s\22, line %d, assertion \22move_is_ok(move)\22 failed\0A\00"
@.str.1 = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/move.c\00"
define i32 @move_order(i32 %0) {
%2 = tail call i32 @move_is_ok(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @my_fatal(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.1, i64 0, i64 0), i32 357)
br label %6
6: ; preds = %4, %1
%7 = shl i32 %0, 3
%8 = and i32 %7, 32760
%9 = ashr i32 %0, 12
%10 = or i32 %8, %9
ret i32 %10
}