#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 decimal_to_binary(int);
int longest_consecutive_one(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("Binary of 25 is %ld \n", decimal_to_binary(5));
  printf("Binary of 65535 is %ld \n", decimal_to_binary(65535));
  int l1 = longest_consecutive_one(decimal_to_binary(5));
  int l2 = longest_consecutive_one(decimal_to_binary(65535));
  printf("l1: %d \n", l1);
  printf("l2: %d \n", l2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1050 <decimal_to_binary@plt>
mov    %eax,%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffff,%edi
call   1050 <decimal_to_binary@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1050 <decimal_to_binary@plt>
mov    %eax,%edi
call   1040 <longest_consecutive_one@plt>
mov    %eax,-0x8(%rbp)
mov    $0xffff,%edi
call   1050 <decimal_to_binary@plt>
mov    %eax,%edi
call   1040 <longest_consecutive_one@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x5,%edi
call   1050 <decimal_to_binary@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xffff,%edi
call   1050 <decimal_to_binary@plt>
lea    0xeba(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1050 <decimal_to_binary@plt>
mov    %eax,%edi
call   1040 <longest_consecutive_one@plt>
mov    %eax,%ebx
mov    $0xffff,%edi
call   1050 <decimal_to_binary@plt>
mov    %eax,%edi
call   1040 <longest_consecutive_one@plt>
mov    %eax,%ebp
lea    0xe9f(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Binary of 25 is %ld \0A\00"
@.str.1 = [25 x i8] c"Binary of 65535 is %ld \0A\00"
@.str.2 = [9 x i8] c"l1: %d \0A\00"
@.str.3 = [9 x i8] c"l2: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @decimal_to_binary(i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @decimal_to_binary(i32 65535)
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @decimal_to_binary(i32 5)
%9 = call i32 @longest_consecutive_one(i32 %8)
store i32 %9, i32* %2
%10 = call i32 @decimal_to_binary(i32 65535)
%11 = call i32 @longest_consecutive_one(i32 %10)
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Binary of 25 is %ld \0A\00"
@.str.1 = [25 x i8] c"Binary of 65535 is %ld \0A\00"
@.str.2 = [9 x i8] c"l1: %d \0A\00"
@.str.3 = [9 x i8] c"l2: %d \0A\00"
define i32 @main() {
%1 = tail call i32 @decimal_to_binary(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @decimal_to_binary(i32 65535)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @decimal_to_binary(i32 5)
%6 = tail call i32 @longest_consecutive_one(i32 %5)
%7 = tail call i32 @decimal_to_binary(i32 65535)
%8 = tail call i32 @longest_consecutive_one(i32 %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %8)
ret i32 0
}