#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*/ my_fatal(char *, char *, int);
int /*<<< orphan*/ square_is_ok(int);
int square_to_64(int);
int square_file(int square) {
  int file;
  {
    if (!(square_is_ok(square)))
      my_fatal("file \"%s\", line %d, assertion \""
               "square_is_ok(square)"
               "\" failed\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/"
               "master/square.c",
               73);
  };
  file = (square - 4) & 7;
  {
    if (!(file == (square_to_64(square) & 7)))
      my_fatal("file \"%s\", line %d, assertion \""
               "file==(square_to_64(square)&7)"
               "\" failed\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/"
               "master/square.c",
               76);
  };
  return file;
}


x86 assembly (clang, -O0):
<square_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <square_is_ok@plt>
cmp    $0x0,%eax
jne    1164 <square_file+0x34>
lea    0xead(%rip),%rdi
lea    0xee3(%rip),%rsi
mov    $0x49,%edx
call   1040 <my_fatal@plt>
mov    -0x4(%rbp),%eax
sub    $0x4,%eax
and    $0x7,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <square_to_64@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    $0x7,%ecx
cmp    %ecx,%eax
je     11a6 <square_file+0x76>
lea    0xf2f(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    $0x4c,%edx
call   1040 <my_fatal@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<square_file>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1050 <square_is_ok@plt>
test   %eax,%eax
jne    1156 <square_file+0x26>
lea    0xebb(%rip),%rdi
lea    0xef1(%rip),%rsi
mov    $0x49,%edx
call   1040 <my_fatal@plt>
lea    0x4(%rbx),%ebp
and    $0x7,%ebp
mov    %ebx,%edi
call   1030 <square_to_64@plt>
and    $0x7,%eax
cmp    %eax,%ebp
je     1182 <square_file+0x52>
lea    0xf53(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    $0x4c,%edx
call   1040 <my_fatal@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [61 x i8] c"file \22%s\22, line %d, assertion \22square_is_ok(square)\22 failed\0A\00"
@.str.1 = [135 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/square.c\00"
@.str.2 = [71 x i8] c"file \22%s\22, line %d, assertion \22file==(square_to_64(square)&7)\22 failed\0A\00"
define i32 @square_file(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @square_is_ok(i32 %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @my_fatal(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 73)
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 4
%12 = and i32 %11, 7
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = call i32 @square_to_64(i32 %14)
%16 = and i32 %15, 7
%17 = icmp eq i32 %13, %16
br i1 %17, label %20, label %18
18: ; preds = %9
%19 = call i32 @my_fatal(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 76)
br label %20
20: ; preds = %18, %9
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [61 x i8] c"file \22%s\22, line %d, assertion \22square_is_ok(square)\22 failed\0A\00"
@.str.1 = [135 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/square.c\00"
@.str.2 = [71 x i8] c"file \22%s\22, line %d, assertion \22file==(square_to_64(square)&7)\22 failed\0A\00"
define i32 @square_file(i32 %0) {
%2 = tail call i32 @square_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 ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 73)
br label %6
6: ; preds = %4, %1
%7 = add i32 %0, 4
%8 = and i32 %7, 7
%9 = tail call i32 @square_to_64(i32 %0)
%10 = and i32 %9, 7
%11 = icmp eq i32 %8, %10
br i1 %11, label %14, label %12
12: ; preds = %6
%13 = tail call i32 @my_fatal(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 76)
br label %14
14: ; preds = %12, %6
ret i32 %8
}