#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 get_ec_codewords(int, int);
int get_total_codewords(int);
int get_data_codewords(int version, int ecLevel) {
  if (version > 0 && version < 41 && ecLevel >= 0 && ecLevel < 4) {
    return get_total_codewords(version) - get_ec_codewords(version, ecLevel);
  }
  return -1;
}


x86 assembly (clang, -O0):
<get_data_codewords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    117b <get_data_codewords+0x5b>
cmpl   $0x29,-0x8(%rbp)
jge    117b <get_data_codewords+0x5b>
cmpl   $0x0,-0xc(%rbp)
jl     117b <get_data_codewords+0x5b>
cmpl   $0x4,-0xc(%rbp)
jge    117b <get_data_codewords+0x5b>
mov    -0x8(%rbp),%edi
call   1040 <get_total_codewords@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <get_ec_codewords@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1182 <get_data_codewords+0x62>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_data_codewords>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffffff,%ebx
cmp    $0x3,%esi
ja     1150 <get_data_codewords+0x30>
mov    %edi,%ebp
lea    -0x1(%rbp),%eax
cmp    $0x27,%eax
ja     1150 <get_data_codewords+0x30>
mov    %esi,%r14d
mov    %ebp,%edi
call   1040 <get_total_codewords@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <get_ec_codewords@plt>
sub    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_data_codewords(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 41
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load i32, i32* %5
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i32, i32* %4
%19 = call i32 @get_total_codewords(i32 %18)
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = call i32 @get_ec_codewords(i32 %20, i32 %21)
%23 = sub nsw i32 %19, %22
store i32 %23, i32* %3
br label %25
24: ; preds = %14, %11, %8, %2
store i32 -1, i32* %3
br label %25
25: ; preds = %24, %17
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @get_data_codewords(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 40
%5 = icmp ult i32 %1, 4
%6 = and i1 %5, %4
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = tail call i32 @get_total_codewords(i32 %0)
%9 = tail call i32 @get_ec_codewords(i32 %0, i32 %1)
%10 = sub nsw i32 %8, %9
br label %11
11: ; preds = %2, %7
%12 = phi i32 [ %10, %7 ], [ -1, %2 ]
ret i32 %12
}