#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 *, int);
int /*<<< orphan*/ scanf(char *, long *);
void initcatn(long *categs) {
  long loopcount;
  loopcount = 0;
  do {
    printf("Number of categories (1-%d)?\n", 9);
    scanf("%ld%*[^\n]", categs);
    getchar();
    countup(&loopcount, 10);
  } while (*categs > 9 || *categs < 1);
}


x86 assembly (clang, -O0):
<initcatn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xea5(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1060 <countup@plt>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpq   $0x9,(%rcx)
mov    %al,-0x11(%rbp)
jg     11ab <initcatn+0x6b>
mov    -0x8(%rbp),%rax
cmpq   $0x1,(%rax)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1154 <initcatn+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initcatn>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
movq   $0x0,(%rsp)
lea    0xea6(%rip),%r14
lea    0xebd(%rip),%r15
mov    %rsp,%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %r12,%rdi
mov    $0xa,%esi
call   1060 <countup@plt>
mov    (%rbx),%rax
add    $0xfffffffffffffff6,%rax
cmp    $0xfffffffffffffff7,%rax
jb     1170 <initcatn+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Number of categories (1-%d)?\0A\00"
@.str.1 = [10 x i8] c"%ld%*[^\0A]\00"
define void @initcatn(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
store i64 0, i64* %3
br label %4
4: ; preds = %18, %1
%5 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 9)
%6 = load i64*, i64** %2
%7 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %6)
%8 = call i32 (...) @getchar()
%9 = call i32 @countup(i64* %3, i32 10)
br label %10
10: ; preds = %4
%11 = load i64*, i64** %2
%12 = load i64, i64* %11
%13 = icmp sgt i64 %12, 9
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i64*, i64** %2
%16 = load i64, i64* %15
%17 = icmp slt i64 %16, 1
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ true, %10 ], [ %17, %14 ]
br i1 %19, label %4, label %20
20: ; preds = %18
ret void
}

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