#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 pow(int, int);
int getExpbits(int num) {
  int result = 0;
  for (int i = 30; i >= 24; i--) {
    int j = num >> i;
    if (j & 1) {
      result = result + pow(2, i - 23);
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<getExpbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1e,-0xc(%rbp)
cmpl   $0x18,-0xc(%rbp)
jl     1180 <getExpbits+0x70>
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     116d <getExpbits+0x5d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
sub    $0x17,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    1172 <getExpbits+0x62>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <getExpbits+0x19>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getExpbits>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %ebx,%ebx
test   $0x40000000,%edi
jne    1175 <getExpbits+0x65>
test   $0x20000000,%ebp
jne    118e <getExpbits+0x7e>
test   $0x10000000,%ebp
jne    11a7 <getExpbits+0x97>
test   $0x8000000,%ebp
jne    11c4 <getExpbits+0xb4>
test   $0x4000000,%ebp
jne    11e1 <getExpbits+0xd1>
test   $0x2000000,%ebp
jne    11fe <getExpbits+0xee>
test   $0x1000000,%ebp
je     116c <getExpbits+0x5c>
mov    $0x2,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
add    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x2,%edi
mov    $0x7,%esi
call   1030 <pow@plt>
mov    %eax,%ebx
test   $0x20000000,%ebp
je     1127 <getExpbits+0x17>
mov    $0x2,%edi
mov    $0x6,%esi
call   1030 <pow@plt>
add    %eax,%ebx
test   $0x10000000,%ebp
je     112f <getExpbits+0x1f>
mov    $0x2,%edi
mov    $0x5,%esi
call   1030 <pow@plt>
add    %eax,%ebx
test   $0x8000000,%ebp
je     113b <getExpbits+0x2b>
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <pow@plt>
add    %eax,%ebx
test   $0x4000000,%ebp
je     1147 <getExpbits+0x37>
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <pow@plt>
add    %eax,%ebx
test   $0x2000000,%ebp
je     1153 <getExpbits+0x43>
mov    $0x2,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
add    %eax,%ebx
test   $0x1000000,%ebp
jne    115b <getExpbits+0x4b>
jmp    116c <getExpbits+0x5c>

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

LLVM IR (-O2):
define i32 @getExpbits(i32 %0) {
%2 = and i32 %0, 1073741824
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @pow(i32 2, i32 7)
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
%8 = and i32 %0, 536870912
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = tail call i32 @pow(i32 2, i32 6)
%12 = add nsw i32 %11, %7
br label %13
13: ; preds = %10, %6
%14 = phi i32 [ %12, %10 ], [ %7, %6 ]
%15 = and i32 %0, 268435456
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %13
%18 = tail call i32 @pow(i32 2, i32 5)
%19 = add nsw i32 %18, %14
br label %20
20: ; preds = %17, %13
%21 = phi i32 [ %19, %17 ], [ %14, %13 ]
%22 = and i32 %0, 134217728
%23 = icmp eq i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = tail call i32 @pow(i32 2, i32 4)
%26 = add nsw i32 %25, %21
br label %27
27: ; preds = %24, %20
%28 = phi i32 [ %26, %24 ], [ %21, %20 ]
%29 = and i32 %0, 67108864
%30 = icmp eq i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %27
%32 = tail call i32 @pow(i32 2, i32 3)
%33 = add nsw i32 %32, %28
br label %34
34: ; preds = %31, %27
%35 = phi i32 [ %33, %31 ], [ %28, %27 ]
%36 = and i32 %0, 33554432
%37 = icmp eq i32 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %34
%39 = tail call i32 @pow(i32 2, i32 2)
%40 = add nsw i32 %39, %35
br label %41
41: ; preds = %38, %34
%42 = phi i32 [ %40, %38 ], [ %35, %34 ]
%43 = and i32 %0, 16777216
%44 = icmp eq i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %41
%46 = tail call i32 @pow(i32 2, i32 1)
%47 = add nsw i32 %46, %42
br label %48
48: ; preds = %45, %41
%49 = phi i32 [ %47, %45 ], [ %42, %41 ]
ret i32 %49
}