#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 getNumRawDataModules(int ver) {
  assert(1 <= ver && ver <= 40);
  int result = (16 * ver + 128) * ver + 64;
  if (ver >= 2) {
    int numAlign = ver / 7 + 2;
    result -= (25 * numAlign - 10) * numAlign - 55;
    if (ver >= 7)
      result -= 36;
  }
  assert(208 <= result && result <= 29648);
  return result;
}


x86 assembly (clang, -O0):
<getNumRawDataModules>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    $0x1,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0xd(%rbp)
jg     1138 <getNumRawDataModules+0x28>
cmpl   $0x28,-0x4(%rbp)
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
add    $0x80,%eax
imul   -0x4(%rbp),%eax
add    $0x40,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     11a3 <getNumRawDataModules+0x93>
mov    -0x4(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
imul   $0x19,-0xc(%rbp),%ecx
sub    $0xa,%ecx
imul   -0xc(%rbp),%ecx
sub    $0x37,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x7,-0x4(%rbp)
jl     119e <getNumRawDataModules+0x8e>
mov    -0x8(%rbp),%eax
sub    $0x24,%eax
mov    %eax,-0x8(%rbp)
jmp    11a3 <getNumRawDataModules+0x93>
xor    %eax,%eax
mov    $0xd0,%ecx
cmp    -0x8(%rbp),%ecx
mov    %al,-0xe(%rbp)
jg     11c3 <getNumRawDataModules+0xb3>
cmpl   $0x73d0,-0x8(%rbp)
setle  %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumRawDataModules>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
lea    -0x1(%r14),%eax
xor    %edi,%edi
cmp    $0x28,%eax
setb   %dil
call   1030 <assert@plt>
mov    %r14d,%ebx
shl    $0x4,%ebx
sub    $0xffffff80,%ebx
imul   %r14d,%ebx
cmp    $0x2,%r14d
jl     1173 <getNumRawDataModules+0x63>
mov    %r14d,%eax
imul   $0x24924925,%rax,%rax
shr    $0x20,%rax
mov    %r14d,%ecx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x2,%ecx
add    $0x2,%ecx
imul   $0xffffffe7,%ecx,%eax
add    $0xa,%eax
imul   %ecx,%eax
cmp    $0x7,%r14d
lea    0x53(%rbx,%rax,1),%ecx
lea    0x77(%rbx,%rax,1),%ebx
cmovae %ecx,%ebx
jmp    1176 <getNumRawDataModules+0x66>
add    $0x40,%ebx
lea    -0xd0(%rbx),%eax
xor    %edi,%edi
cmp    $0x7301,%eax
setb   %dil
call   1030 <assert@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @getNumRawDataModules(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp sle i32 1, %5
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 40
br label %10
10: ; preds = %7, %1
%11 = phi i1 [ false, %1 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %2
%15 = mul nsw i32 16, %14
%16 = add nsw i32 %15, 128
%17 = load i32, i32* %2
%18 = mul nsw i32 %16, %17
%19 = add nsw i32 %18, 64
store i32 %19, i32* %3
%20 = load i32, i32* %2
%21 = icmp sge i32 %20, 2
br i1 %21, label %22, label %40
22: ; preds = %10
%23 = load i32, i32* %2
%24 = sdiv i32 %23, 7
%25 = add nsw i32 %24, 2
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = mul nsw i32 25, %26
%28 = sub nsw i32 %27, 10
%29 = load i32, i32* %4
%30 = mul nsw i32 %28, %29
%31 = sub nsw i32 %30, 55
%32 = load i32, i32* %3
%33 = sub nsw i32 %32, %31
store i32 %33, i32* %3
%34 = load i32, i32* %2
%35 = icmp sge i32 %34, 7
br i1 %35, label %36, label %39
36: ; preds = %22
%37 = load i32, i32* %3
%38 = sub nsw i32 %37, 36
store i32 %38, i32* %3
br label %39
39: ; preds = %36, %22
br label %40
40: ; preds = %39, %10
%41 = load i32, i32* %3
%42 = icmp sle i32 208, %41
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i32, i32* %3
%45 = icmp sle i32 %44, 29648
br label %46
46: ; preds = %43, %40
%47 = phi i1 [ false, %40 ], [ %45, %43 ]
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
define i32 @getNumRawDataModules(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 40
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = shl nsw i32 %0, 4
%7 = add nsw i32 %6, 128
%8 = mul nsw i32 %7, %0
%9 = add nsw i32 %8, 64
%10 = icmp sgt i32 %0, 1
br i1 %10, label %11, label %22
11: ; preds = %1
%12 = udiv i32 %0, 7
%13 = add nuw nsw i32 %12, 2
%14 = mul i32 %13, -25
%15 = add i32 %14, 10
%16 = mul i32 %15, %13
%17 = add i32 %8, 119
%18 = add i32 %17, %16
%19 = icmp ugt i32 %0, 6
%20 = add nsw i32 %18, -36
%21 = select i1 %19, i32 %20, i32 %18
br label %22
22: ; preds = %11, %1
%23 = phi i32 [ %21, %11 ], [ %9, %1 ]
%24 = add i32 %23, -208
%25 = icmp ult i32 %24, 29441
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
ret i32 %23
}