#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 */
double fmax(double, double);
double fmod(int, int);
int execute(int value) {
  while (value > 0 && fmod(value, 2) == 0)
    value = value / 2;
  double currentGap = 0;
  double maxGap = 0;
  while (value > 0) {
    double remainder = fmod(value, 2);
    if (remainder == 0) {
      currentGap++;
    } else if (currentGap != 0) {
      maxGap = fmax(currentGap, maxGap);
      currentGap = 0;
    }
    value = value / 2;
  }
  return maxGap;
}


x86 assembly (clang, -O0):
<execute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x21(%rbp)
jle    1149 <execute+0x39>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <fmod@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1159 <execute+0x49>
jmp    116c <execute+0x5c>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    111b <execute+0xb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1231 <execute+0x121>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <fmod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c7 <execute+0xb7>
jp     11c7 <execute+0xb7>
movsd  0xe48(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    121e <execute+0x10e>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11e4 <execute+0xd4>
jp     11e4 <execute+0xd4>
jmp    1219 <execute+0x109>
movsd  -0x10(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
maxsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    121e <execute+0x10e>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    117c <execute+0x6c>
cvttsd2si -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
test   %edi,%edi
jle    11fa <execute+0xea>
mov    %edi,%ebp
mov    %ebp,%edi
mov    $0x2,%esi
call   1030 <fmod@plt>
ucomisd 0xed4(%rip),%xmm0
jne    11f0 <execute+0xe0>
jp     11f0 <execute+0xe0>
mov    %ebp,%ebx
shr    %ebx
cmp    $0x1,%ebp
mov    %ebx,%ebp
ja     1120 <execute+0x10>
test   %ebx,%ebx
je     11fa <execute+0xea>
xorpd  %xmm0,%xmm0
movapd %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
jmp    118f <execute+0x7f>
nopl   0x0(%rax)
movsd  0x8(%rsp),%xmm0
addsd  0xe82(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%eax
shr    %eax
cmp    $0x1,%ebx
mov    %eax,%ebx
jbe    1204 <execute+0xf4>
mov    %ebx,%edi
mov    $0x2,%esi
call   1030 <fmod@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a7 <execute+0x97>
jnp    1170 <execute+0x60>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jne    11b5 <execute+0xa5>
jnp    1184 <execute+0x74>
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm0
cmpunordsd %xmm3,%xmm0
movapd %xmm0,%xmm1
movapd 0x10(%rsp),%xmm2
andpd  %xmm2,%xmm1
maxsd  %xmm3,%xmm2
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
xorpd  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,0x10(%rsp)
jmp    1184 <execute+0x74>
mov    %ebp,%ebx
test   %ebx,%ebx
jne    1153 <execute+0x43>
xorpd  %xmm0,%xmm0
movapd %xmm0,0x10(%rsp)
cvttsd2si 0x10(%rsp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @execute(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 %0, i32* %2
br label %6
6: ; preds = %15, %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %2
%11 = call double @fmod(i32 %10, i32 2)
%12 = fcmp oeq double %11, 0.000000e+00
br label %13
13: ; preds = %9, %6
%14 = phi i1 [ false, %6 ], [ %12, %9 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 2
store i32 %17, i32* %2
br label %6
18: ; preds = %13
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
br label %19
19: ; preds = %38, %18
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %41
22: ; preds = %19
%23 = load i32, i32* %2
%24 = call double @fmod(i32 %23, i32 2)
store double %24, double* %5
%25 = load double, double* %5
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load double, double* %3
%29 = fadd double %28, 1.000000e+00
store double %29, double* %3
br label %38
30: ; preds = %22
%31 = load double, double* %3
%32 = fcmp une double %31, 0.000000e+00
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load double, double* %3
%35 = load double, double* %4
%36 = call double @llvm.maxnum.f64(double %34, double %35)
store double %36, double* %4
store double 0.000000e+00, double* %3
br label %37
37: ; preds = %33, %30
br label %38
38: ; preds = %37, %27
%39 = load i32, i32* %2
%40 = sdiv i32 %39, 2
store i32 %40, i32* %2
br label %19
41: ; preds = %19
%42 = load double, double* %4
%43 = fptosi double %42 to i32
ret i32 %43
}

LLVM IR (-O2):
define i32 @execute(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %30
3: ; preds = %1, %7
%4 = phi i32 [ %8, %7 ], [ %0, %1 ]
%5 = tail call double @fmod(i32 %4, i32 2)
%6 = fcmp oeq double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = lshr i32 %4, 1
%9 = icmp ult i32 %4, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %7
%11 = phi i32 [ %4, %3 ], [ %8, %7 ]
%12 = icmp eq i32 %11, 0
br i1 %12, label %30, label %13
13: ; preds = %10, %25
%14 = phi i32 [ %28, %25 ], [ %11, %10 ]
%15 = phi double [ %27, %25 ], [ 0.000000e+00, %10 ]
%16 = phi double [ %26, %25 ], [ 0.000000e+00, %10 ]
%17 = tail call double @fmod(i32 %14, i32 2)
%18 = fcmp oeq double %17, 0.000000e+00
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = fadd double %16, 1.000000e+00
br label %25
21: ; preds = %13
%22 = fcmp une double %16, 0.000000e+00
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = tail call double @llvm.maxnum.f64(double %16, double %15)
br label %25
25: ; preds = %21, %23, %19
%26 = phi double [ %20, %19 ], [ 0.000000e+00, %23 ], [ %16, %21 ]
%27 = phi double [ %15, %19 ], [ %24, %23 ], [ %15, %21 ]
%28 = lshr i32 %14, 1
%29 = icmp ult i32 %14, 2
br i1 %29, label %30, label %13
30: ; preds = %25, %1, %10
%31 = phi double [ 0.000000e+00, %10 ], [ 0.000000e+00, %1 ], [ %27, %25 ]
%32 = fptosi double %31 to i32
ret i32 %32
}