#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 */
long calcStuffBufferBitSize(unsigned char *, int);
int /*<<< orphan*/ printf(char *, ...);
int testNoFiveBits() {
  unsigned char testS[] = {0x00, 0x00};
  long bits = calcStuffBufferBitSize(testS, 2);
  if (bits != 16) {
    printf("testNoFiveBits -- Failed expected 16 but got %ld\n", bits);
    return 1;
  }
  printf("testNoFiveBits -- Passed\n");
  return 0;
}


x86 assembly (clang, -O0):
<testNoFiveBits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x6(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <memset@plt>
lea    -0x6(%rbp),%rdi
mov    $0x2,%esi
call   1050 <calcStuffBufferBitSize@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x10,-0x10(%rbp)
je     1183 <testNoFiveBits+0x53>
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1198 <testNoFiveBits+0x68>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testNoFiveBits>:
push   %rax
movw   $0x0,0x6(%rsp)
lea    0x6(%rsp),%rdi
mov    $0x2,%esi
call   1050 <calcStuffBufferBitSize@plt>
cmp    $0x10,%rax
jne    115d <testNoFiveBits+0x2d>
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe9c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"testNoFiveBits -- Failed expected 16 but got %ld\0A\00"
@.str.1 = [26 x i8] c"testNoFiveBits -- Passed\0A\00"
define i32 @testNoFiveBits() {
%1 = alloca i32
%2 = alloca [2 x i8]
%3 = alloca i64
%4 = bitcast [2 x i8]* %2 to i8*
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%6 = call i64 @calcStuffBufferBitSize(i8* %5, i32 2)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = icmp ne i64 %7, 16
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i64, i64* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i64 %10)
store i32 1, i32* %1
br label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [50 x i8] c"testNoFiveBits -- Failed expected 16 but got %ld\0A\00"
@str = [25 x i8] c"testNoFiveBits -- Passed\00"
define i32 @testNoFiveBits() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
store i16 0, i16* %1
%3 = call i64 @calcStuffBufferBitSize(i8* %2, i32 2)
%4 = icmp eq i64 %3, 16
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i64 %3)
br label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 1, %5 ], [ 0, %7 ]
ret i32 %10
}