#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void check_dimensions(size_t r, size_t s) {
  if (r % 2) {
    fprintf(stderr, "r must be even\n");
    exit(0);
  }
  if (r % s) {
    fprintf(stderr, "s must divide r\n");
    exit(0);
  }
  if (r < 2 * s * s) {
    fprintf(stderr, "r must be grater than 2s²\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<check_dimensions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     115e <check_dimensions+0x3e>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
cmp    $0x0,%rdx
je     1190 <check_dimensions+0x70>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x1,%rcx
imul   -0x10(%rbp),%rcx
cmp    %rcx,%rax
jae    11c6 <check_dimensions+0xa6>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_dimensions>:
push   %rax
test   $0x1,%dil
jne    116b <check_dimensions+0x4b>
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     114e <check_dimensions+0x2e>
mov    %rdi,%rax
xor    %edx,%edx
div    %rsi
test   %rdx,%rdx
jne    1159 <check_dimensions+0x39>
imul   %rsi,%rsi
add    %rsi,%rsi
cmp    %rdi,%rsi
ja     117d <check_dimensions+0x5d>
pop    %rax
ret
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %rdx,%rdx
je     1140 <check_dimensions+0x20>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
jmp    118d <check_dimensions+0x6d>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
jmp    118d <check_dimensions+0x6d>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"r must be even\0A\00"
@.str.1 = [17 x i8] c"s must divide r\0A\00"
@.str.2 = [28 x i8] c"r must be grater than 2s\C2\B2\0A\00"
define void @check_dimensions(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = urem i64 %5, 2
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = urem i64 %13, %14
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %12
%22 = load i64, i64* %3
%23 = load i64, i64* %4
%24 = mul i64 2, %23
%25 = load i64, i64* %4
%26 = mul i64 %24, %25
%27 = icmp ult i64 %22, %26
br i1 %27, label %28, label %32
28: ; preds = %21
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @exit(i32 0)
unreachable
32: ; preds = %21
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"r must be even\0A\00"
@.str.1 = [17 x i8] c"s must divide r\0A\00"
@.str.2 = [28 x i8] c"r must be grater than 2s\C2\B2\0A\00"
define void @check_dimensions(i64 %0, i64 %1) {
%3 = and i64 %0, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = urem i64 %0, %1
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @exit(i32 0)
unreachable
16: ; preds = %9
%17 = shl i64 %1, 1
%18 = mul i64 %17, %1
%19 = icmp ugt i64 %18, %0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call i32 @exit(i32 0)
unreachable
24: ; preds = %16
ret void
}