#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*/ get_help_topics(char **, int *);
int /*<<< orphan*/ printf(char *, int, char *);
int webhook_menuinfo(int argc, char *argv[]) {
  char *topic[32];
  int j, ntopic;
  get_help_topics(topic, &ntopic);
  for (j = 0; j < ntopic; j++)
    printf("$help_menu[%d]=\"/heyu/help %s\";\n", j, topic[j]);
  return 0;
}


x86 assembly (clang, -O0):
<webhook_menuinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
lea    -0x118(%rbp),%rsi
call   1030 <get_help_topics@plt>
movl   $0x0,-0x114(%rbp)
mov    -0x114(%rbp),%eax
cmp    -0x118(%rbp),%eax
jge    1196 <webhook_menuinfo+0x76>
mov    -0x114(%rbp),%esi
movslq -0x114(%rbp),%rax
mov    -0x110(%rbp,%rax,8),%rdx
ff
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    114f <webhook_menuinfo+0x2f>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<webhook_menuinfo>:
push   %r14
push   %rbx
sub    $0x118,%rsp
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1030 <get_help_topics@plt>
cmpl   $0x0,0xc(%rsp)
jle    116d <webhook_menuinfo+0x4d>
xor    %ebx,%ebx
lea    0xeb7(%rip),%r14
nopl   0x0(%rax)
mov    0x10(%rsp,%rbx,8),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1150 <webhook_menuinfo+0x30>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"$help_menu[%d]=\22/heyu/help %s\22;\0A\00"
define i32 @webhook_menuinfo(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [32 x i8*]
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = getelementptr inbounds [32 x i8*], [32 x i8*]* %5, i64 0, i64 0
%9 = call i32 @get_help_topics(i8** %8, i32* %7)
store i32 0, i32* %6
br label %10
10: ; preds = %21, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i32, i32* %6
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [32 x i8*], [32 x i8*]* %5, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %10
24: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"$help_menu[%d]=\22/heyu/help %s\22;\0A\00"
define i32 @webhook_menuinfo(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i8*]
%4 = alloca i32
%5 = bitcast [32 x i8*]* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = getelementptr inbounds [32 x i8*], [32 x i8*]* %3, i64 0, i64 0
%8 = call i32 @get_help_topics(i8** %7, i32* %4)
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %2, %11
%12 = phi i64 [ %17, %11 ], [ 0, %2 ]
%13 = getelementptr inbounds [32 x i8*], [32 x i8*]* %3, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = trunc i64 %12 to i32
%16 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %14)
%17 = add nuw nsw i64 %12, 1
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %11, label %21
21: ; preds = %11, %2
ret i32 0
}