#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*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
int maze_row_col_frac(int rc, int num, int den) {
  if (rc <= 0 || num < 0 || den <= 0)
    do {
      fprintf(stderr, "Aborted at %s:%d\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/brendanlong/perfbook/refs/heads/"
              "epub-output/CodeSamples/SMPdesign/maze/maze.c",
              46);
      abort();
    } while (0);
  return ((rc - 1) * num + den - 1) / den;
}


x86 assembly (clang, -O0):
<maze_row_col_frac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    114f <maze_row_col_frac+0x2f>
cmpl   $0x0,-0x8(%rbp)
jl     114f <maze_row_col_frac+0x2f>
cmpl   $0x0,-0xc(%rbp)
jg     117c <maze_row_col_frac+0x5c>
jmp    1154 <maze_row_col_frac+0x34>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
lea    0xea7(%rip),%rdx
mov    $0x2e,%ecx
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
imul   -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0xc(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maze_row_col_frac>:
test   %edi,%edi
jle    113e <maze_row_col_frac+0x1e>
test   %esi,%esi
js     113e <maze_row_col_frac+0x1e>
mov    %edx,%ecx
test   %edx,%edx
jle    113e <maze_row_col_frac+0x1e>
add    $0xffffffff,%edi
imul   %esi,%edi
lea    (%rcx,%rdi,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %ecx
ret
push   %rax
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
lea    0xebc(%rip),%rdx
mov    $0x2e,%ecx
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Aborted at %s:%d\0A\00"
@.str.1 = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/brendanlong/perfbook/refs/heads/epub-output/CodeSamples/SMPdesign/maze/maze.c\00"
define i32 @maze_row_col_frac(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %3
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %6
%14 = icmp sle i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %12, %9, %3
br label %16
16: ; preds = %15
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.1, i64 0, i64 0), i32 46)
%19 = call i32 (...) @abort()
unreachable
20: ; No predecessors!
br label %21
21: ; preds = %20, %12
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
%24 = load i32, i32* %5
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %6
%27 = add nsw i32 %25, %26
%28 = sub nsw i32 %27, 1
%29 = load i32, i32* %6
%30 = sdiv i32 %28, %29
ret i32 %30
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Aborted at %s:%d\0A\00"
@.str.1 = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/brendanlong/perfbook/refs/heads/epub-output/CodeSamples/SMPdesign/maze/maze.c\00"
define i32 @maze_row_col_frac(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, 1
%5 = icmp slt i32 %1, 0
%6 = or i1 %4, %5
%7 = icmp slt i32 %2, 1
%8 = or i1 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.1, i64 0, i64 0), i32 46)
%12 = tail call i32 (...) @abort()
unreachable
13: ; preds = %3
%14 = add nsw i32 %0, -1
%15 = mul nsw i32 %14, %1
%16 = add nsw i32 %2, -1
%17 = add i32 %16, %15
%18 = sdiv i32 %17, %2
ret i32 %18
}