#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*/ countup(long *, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ scanf(char *, long *);
void inithowmany(long *howmanny, long howoften) {
  long loopcount;
  loopcount = 0;
  do {
    printf("How many cycles of %4ld trees?\n", howoften);
    scanf("%ld%*[^\n]", howmanny);
    getchar();
    countup(&loopcount, 10);
  } while (*howmanny <= 0);
}


x86 assembly (clang, -O0):
<inithowmany>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    -0x18(%rbp),%rdi
mov    $0xa,%esi
call   1060 <countup@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jle    1158 <inithowmany+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inithowmany>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
lea    0xe9d(%rip),%r15
lea    0xeb6(%rip),%r12
lea    0x8(%rsp),%r13
nop
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %r13,%rdi
mov    $0xa,%esi
call   1060 <countup@plt>
cmpq   $0x0,(%rbx)
jle    1170 <inithowmany+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"How many cycles of %4ld trees?\0A\00"
@.str.1 = [10 x i8] c"%ld%*[^\0A]\00"
define void @inithowmany(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %13, %2
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = load i64*, i64** %3
%10 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %9)
%11 = call i32 (...) @getchar()
%12 = call i32 @countup(i64* %5, i32 10)
br label %13
13: ; preds = %6
%14 = load i64*, i64** %3
%15 = load i64, i64* %14
%16 = icmp sle i64 %15, 0
br i1 %16, label %6, label %17
17: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"How many cycles of %4ld trees?\0A\00"
@.str.1 = [10 x i8] c"%ld%*[^\0A]\00"
define void @inithowmany(i64* %0, i64 %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
br label %5
5: ; preds = %5, %2
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %1)
%7 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %0)
%8 = call i32 (...) @getchar()
%9 = call i32 @countup(i64* %3, i32 10)
%10 = load i64, i64* %0
%11 = icmp slt i64 %10, 1
br i1 %11, label %5, label %12
12: ; preds = %5
ret void
}