#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 /*<<< orphan*/ printf(char *, int);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int x = strtol(argv[1], NULL, 10);
  int y = strtol(argv[2], NULL, 10);
  int weeks = 1, fruits = 0, plants = y;
  do {
    weeks++;
    fruits += plants;
    plants += fruits;
  } while (fruits < x);
  printf("%d", weeks);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     117c <main+0x5c>
mov    -0x1c(%rbp),%esi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,%ebp
mov    0x10(%r14),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    $0x1,%esi
add    $0x1,%esi
add    %eax,%ebx
add    %ebx,%eax
cmp    %ebp,%ebx
jl     1150 <main+0x30>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strtol(i8* %13, i32* null, i32 10)
store i32 %14, i32* %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @strtol(i8* %17, i32* null, i32 10)
store i32 %18, i32* %7
store i32 1, i32* %8
store i32 0, i32* %9
%19 = load i32, i32* %7
store i32 %19, i32* %10
br label %20
20: ; preds = %29, %2
%21 = load i32, i32* %8
%22 = add nsw i32 %21, 1
store i32 %22, i32* %8
%23 = load i32, i32* %10
%24 = load i32, i32* %9
%25 = add nsw i32 %24, %23
store i32 %25, i32* %9
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = add nsw i32 %27, %26
store i32 %28, i32* %10
br label %29
29: ; preds = %20
%30 = load i32, i32* %9
%31 = load i32, i32* %6
%32 = icmp slt i32 %30, %31
br i1 %32, label %20, label %33
33: ; preds = %29
%34 = load i32, i32* %8
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @strtol(i8* nocapture %4, i32* null, i32 10)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @strtol(i8* nocapture %7, i32* null, i32 10)
br label %9
9: ; preds = %9, %2
%10 = phi i32 [ 1, %2 ], [ %13, %9 ]
%11 = phi i32 [ 0, %2 ], [ %14, %9 ]
%12 = phi i32 [ %8, %2 ], [ %15, %9 ]
%13 = add nuw nsw i32 %10, 1
%14 = add nsw i32 %12, %11
%15 = add nsw i32 %14, %12
%16 = icmp slt i32 %14, %5
br i1 %16, label %9, label %17
17: ; preds = %9
%18 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}