#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;
  *categs = 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)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
lea    0xe9a(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xea3(%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     11b6 <initcatn+0x76>
mov    -0x8(%rbp),%rax
cmpq   $0x1,(%rax)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115f <initcatn+0x1f>
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)
movq   $0x0,(%rdi)
lea    0xe9f(%rip),%r14
lea    0xeb6(%rip),%r15
mov    %rsp,%r12
nopl   0x0(%rax,%rax,1)
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
%4 = load i64*, i64** %2
store i64 0, i64* %4
br label %5
5: ; preds = %19, %1
%6 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 9)
%7 = load i64*, i64** %2
%8 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %7)
%9 = call i32 (...) @getchar()
%10 = call i32 @countup(i64* %3, i32 10)
br label %11
11: ; preds = %5
%12 = load i64*, i64** %2
%13 = load i64, i64* %12
%14 = icmp sgt i64 %13, 9
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load i64*, i64** %2
%17 = load i64, i64* %16
%18 = icmp slt i64 %17, 1
br label %19
19: ; preds = %15, %11
%20 = phi i1 [ true, %11 ], [ %18, %15 ]
br i1 %20, label %5, label %21
21: ; preds = %19
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
store i64 0, i64* %0
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
}