#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*/ assert(int);
int symmetrize_index_inside(int i, int m) {
  assert(i >= 0 && i < m);
  int r = 0;
  if (i >= m / 2)
    r = i - m;
  if (i < m / 2)
    r = i;
  return r;
}


x86 assembly (clang, -O0):
<symmetrize_index_inside>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xd(%rbp)
jl     1139 <symmetrize_index_inside+0x29>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jl     1174 <symmetrize_index_inside+0x64>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1198 <symmetrize_index_inside+0x88>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<symmetrize_index_inside>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
test   %edi,%edi
setns  %al
cmp    %esi,%edi
setl   %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
sar    %eax
xor    %ecx,%ecx
cmp    %ebp,%eax
cmovle %ebx,%ecx
sub    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @symmetrize_index_inside(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br label %12
12: ; preds = %8, %2
%13 = phi i1 [ false, %2 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
store i32 0, i32* %5
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = sdiv i32 %17, 2
%19 = icmp sge i32 %16, %18
br i1 %19, label %20, label %24
20: ; preds = %12
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %5
br label %24
24: ; preds = %20, %12
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = sdiv i32 %26, 2
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = load i32, i32* %3
store i32 %30, i32* %5
br label %31
31: ; preds = %29, %24
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
define i32 @symmetrize_index_inside(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, -1
%4 = icmp slt i32 %0, %1
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = sdiv i32 %1, 2
%9 = icmp sgt i32 %8, %0
%10 = select i1 %9, i32 0, i32 %1
%11 = sub nsw i32 %0, %10
ret i32 %11
}