#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ _fail(char *);
int cris_lz(int);
void check_lz(void) {
  int i;
  if (cris_lz(0) != 32) {
    _fail("at "
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/"
          "qemu/tests/tcg/cris/check_lz.c"
          ":"
          "18"
          " ");
  };
  if (cris_lz(1) != 31) {
    _fail("at "
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/"
          "qemu/tests/tcg/cris/check_lz.c"
          ":"
          "20"
          " ");
  };
  if (cris_lz(2) != 30) {
    _fail("at "
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/"
          "qemu/tests/tcg/cris/check_lz.c"
          ":"
          "22"
          " ");
  };
  if (cris_lz(4) != 29) {
    _fail("at "
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/"
          "qemu/tests/tcg/cris/check_lz.c"
          ":"
          "24"
          " ");
  };
  if (cris_lz(8) != 28) {
    _fail("at "
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/"
          "qemu/tests/tcg/cris/check_lz.c"
          ":"
          "26"
          " ");
  };
  for (i = 1; i < 32; i++) {
    if (cris_lz(1 << (i - 1)) != (32 - i)) {
      _fail("at "
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/"
            "qemu/tests/tcg/cris/check_lz.c"
            ":"
            "31"
            " ");
    };
  }
  for (i = 1; i < 32; i++) {
    uint32_t val;
    val = (unsigned int)-1 >> (32 - i);
    if (cris_lz(val) != (32 - i)) {
      _fail("at "
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/"
            "qemu/tests/tcg/cris/check_lz.c"
            ":"
            "40"
            " ");
    };
  }
}


x86 assembly (clang, -O0):
<check_lz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <cris_lz@plt>
cmp    $0x20,%eax
je     1144 <check_lz+0x24>
lea    0xec1(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x1,%edi
call   1040 <cris_lz@plt>
cmp    $0x1f,%eax
je     1163 <check_lz+0x43>
lea    0xf48(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x2,%edi
call   1040 <cris_lz@plt>
cmp    $0x1e,%eax
je     1182 <check_lz+0x62>
lea    0xfcf(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x4,%edi
call   1040 <cris_lz@plt>
cmp    $0x1d,%eax
je     11a1 <check_lz+0x81>
lea    0x1056(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x8,%edi
call   1040 <cris_lz@plt>
cmp    $0x1c,%eax
je     11c0 <check_lz+0xa0>
lea    0x10dd(%rip),%rdi
call   1030 <_fail@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    1212 <check_lz+0xf2>
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edi
shl    %cl,%edi
call   1040 <cris_lz@plt>
mov    $0x20,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
je     11ff <check_lz+0xdf>
lea    0x1144(%rip),%rdi
call   1030 <_fail@plt>
jmp    1204 <check_lz+0xe4>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11c7 <check_lz+0xa7>
movl   $0x1,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    126c <check_lz+0x14c>
mov    $0x20,%ecx
sub    -0x4(%rbp),%ecx
mov    $0xffffffff,%eax
shr    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <cris_lz@plt>
mov    $0x20,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
je     1259 <check_lz+0x139>
lea    0x1190(%rip),%rdi
call   1030 <_fail@plt>
jmp    125e <check_lz+0x13e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <check_lz+0xf9>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_lz>:
push   %rbp
push   %r14
push   %rbx
xor    %edi,%edi
call   1040 <cris_lz@plt>
cmp    $0x20,%eax
je     113c <check_lz+0x1c>
lea    0xec9(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x1,%edi
call   1040 <cris_lz@plt>
cmp    $0x1f,%eax
je     1157 <check_lz+0x37>
lea    0xf54(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x2,%edi
call   1040 <cris_lz@plt>
cmp    $0x1e,%eax
je     1172 <check_lz+0x52>
lea    0xfdf(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x4,%edi
call   1040 <cris_lz@plt>
cmp    $0x1d,%eax
je     118d <check_lz+0x6d>
lea    0x106a(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x8,%edi
call   1040 <cris_lz@plt>
cmp    $0x1c,%eax
je     11a8 <check_lz+0x88>
lea    0x10f5(%rip),%rdi
call   1030 <_fail@plt>
mov    $0x1f,%ebp
xor    %ebx,%ebx
lea    0x1188(%rip),%r14
jmp    11c8 <check_lz+0xa8>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0xffffffff,%ebp
je     11e4 <check_lz+0xc4>
mov    $0x1,%edi
mov    %ebx,%ecx
shl    %cl,%edi
call   1040 <cris_lz@plt>
cmp    %eax,%ebp
je     11c0 <check_lz+0xa0>
mov    %r14,%rdi
call   1030 <_fail@plt>
jmp    11c0 <check_lz+0xa0>
mov    $0x1f,%ebx
lea    0x11f4(%rip),%r14
jmp    1205 <check_lz+0xe5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffff,%ebx
je     1221 <check_lz+0x101>
mov    $0xffffffff,%edi
mov    %ebx,%ecx
shr    %cl,%edi
call   1040 <cris_lz@plt>
cmp    %eax,%ebx
je     1200 <check_lz+0xe0>
mov    %r14,%rdi
call   1030 <_fail@plt>
jmp    1200 <check_lz+0xe0>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:18 \00"
@.str.1 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:20 \00"
@.str.2 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:22 \00"
@.str.3 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:24 \00"
@.str.4 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:26 \00"
@.str.5 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:31 \00"
@.str.6 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:40 \00"
define void @check_lz() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @cris_lz(i32 0)
%4 = icmp ne i32 %3, 32
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = call i32 @cris_lz(i32 1)
%9 = icmp ne i32 %8, 31
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = call i32 @cris_lz(i32 2)
%14 = icmp ne i32 %13, 30
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = call i32 @cris_lz(i32 4)
%19 = icmp ne i32 %18, 29
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = call i32 @cris_lz(i32 8)
%24 = icmp ne i32 %23, 28
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
store i32 1, i32* %1
br label %28
28: ; preds = %42, %27
%29 = load i32, i32* %1
%30 = icmp slt i32 %29, 32
br i1 %30, label %31, label %45
31: ; preds = %28
%32 = load i32, i32* %1
%33 = sub nsw i32 %32, 1
%34 = shl i32 1, %33
%35 = call i32 @cris_lz(i32 %34)
%36 = load i32, i32* %1
%37 = sub nsw i32 32, %36
%38 = icmp ne i32 %35, %37
br i1 %38, label %39, label %41
39: ; preds = %31
%40 = call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %31
br label %42
42: ; preds = %41
%43 = load i32, i32* %1
%44 = add nsw i32 %43, 1
store i32 %44, i32* %1
br label %28
45: ; preds = %28
store i32 1, i32* %1
br label %46
46: ; preds = %61, %45
%47 = load i32, i32* %1
%48 = icmp slt i32 %47, 32
br i1 %48, label %49, label %64
49: ; preds = %46
%50 = load i32, i32* %1
%51 = sub nsw i32 32, %50
%52 = lshr i32 -1, %51
store i32 %52, i32* %2
%53 = load i32, i32* %2
%54 = call i32 @cris_lz(i32 %53)
%55 = load i32, i32* %1
%56 = sub nsw i32 32, %55
%57 = icmp ne i32 %54, %56
br i1 %57, label %58, label %60
58: ; preds = %49
%59 = call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.6, i64 0, i64 0))
br label %60
60: ; preds = %58, %49
br label %61
61: ; preds = %60
%62 = load i32, i32* %1
%63 = add nsw i32 %62, 1
store i32 %63, i32* %1
br label %46
64: ; preds = %46
ret void
}

LLVM IR (-O2):
@.str = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:18 \00"
@.str.1 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:20 \00"
@.str.2 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:22 \00"
@.str.3 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:24 \00"
@.str.4 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:26 \00"
@.str.5 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:31 \00"
@.str.6 = [166 x i8] c"at /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/cris/check_lz.c:40 \00"
define void @check_lz() {
%1 = tail call i32 @cris_lz(i32 0)
%2 = icmp eq i32 %1, 32
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @cris_lz(i32 1)
%7 = icmp eq i32 %6, 31
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = tail call i32 @cris_lz(i32 2)
%12 = icmp eq i32 %11, 30
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = tail call i32 @cris_lz(i32 4)
%17 = icmp eq i32 %16, 29
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = tail call i32 @cris_lz(i32 8)
%22 = icmp eq i32 %21, 28
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = tail call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
br label %26
26: ; preds = %25, %35
%27 = phi i32 [ %36, %35 ], [ 1, %25 ]
%28 = add nsw i32 %27, -1
%29 = shl nuw nsw i32 1, %28
%30 = tail call i32 @cris_lz(i32 %29)
%31 = sub nuw nsw i32 32, %27
%32 = icmp eq i32 %30, %31
br i1 %32, label %35, label %33
33: ; preds = %26
%34 = tail call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.5, i64 0, i64 0))
br label %35
35: ; preds = %26, %33
%36 = add nuw nsw i32 %27, 1
%37 = icmp eq i32 %36, 32
br i1 %37, label %38, label %26
38: ; preds = %35, %46
%39 = phi i32 [ %47, %46 ], [ 1, %35 ]
%40 = sub nuw nsw i32 32, %39
%41 = lshr i32 -1, %40
%42 = tail call i32 @cris_lz(i32 %41)
%43 = icmp eq i32 %42, %40
br i1 %43, label %46, label %44
44: ; preds = %38
%45 = tail call i32 @_fail(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.6, i64 0, i64 0))
br label %46
46: ; preds = %44, %38
%47 = add nuw nsw i32 %39, 1
%48 = icmp eq i32 %47, 32
br i1 %48, label %49, label %38
49: ; preds = %46
ret void
}