#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*/ CmdEndParagraph(int /*<<< orphan*/);
int /*<<< orphan*/ ConvertString(char *);
int /*<<< orphan*/ diagnostics(int, char *);
int /*<<< orphan*/ fprintRTF(char *, char);
int /*<<< orphan*/ free(char *);
char *getBraceParam();
char *getBracketParam();
int getCounter(char *);
int /*<<< orphan*/ incrementCounter(char *);
int /*<<< orphan*/ startParagraph(char *, int);
void CmdSubFigure(int code) {
  char *caption, *contents;
  diagnostics(4, "CmdSubFigure");
  caption = getBracketParam();
  contents = getBraceParam();
  startParagraph("subfigure", 1);
  ConvertString(contents);
  free(contents);
  CmdEndParagraph(0);
  if (caption) {
    int n;
    startParagraph("subfigure", 1);
    n = getCounter("subfigure");
    fprintRTF("(%c) ", (char)(n + (int)'a'));
    ConvertString(caption);
    CmdEndParagraph(0);
    free(caption);
  }
  incrementCounter("subfigure");
}


x86 assembly (clang, -O0):
<CmdSubFigure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%edi
lea    0xe49(%rip),%rsi
call   1060 <diagnostics@plt>
mov    $0x0,%al
call   1090 <getBracketParam@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getBraceParam@plt>
mov    %rax,-0x18(%rbp)
lea    0xe34(%rip),%rdi
mov    $0x1,%esi
call   1070 <startParagraph@plt>
mov    -0x18(%rbp),%rdi
call   1050 <ConvertString@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10c0 <CmdEndParagraph@plt>
cmpq   $0x0,-0x10(%rbp)
je     1255 <CmdSubFigure+0xb5>
lea    0xdff(%rip),%rdi
mov    $0x1,%esi
call   1070 <startParagraph@plt>
lea    0xdee(%rip),%rdi
call   1080 <getCounter@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x61,%eax
lea    0xde3(%rip),%rdi
movsbl %al,%esi
call   10a0 <fprintRTF@plt>
mov    -0x10(%rbp),%rdi
call   1050 <ConvertString@plt>
xor    %edi,%edi
call   10c0 <CmdEndParagraph@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
lea    0xdb1(%rip),%rdi
call   10b0 <incrementCounter@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdSubFigure>:
push   %r14
push   %rbx
push   %rax
lea    0xe55(%rip),%rsi
mov    $0x4,%edi
call   1060 <diagnostics@plt>
xor    %eax,%eax
call   1090 <getBracketParam@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1040 <getBraceParam@plt>
mov    %rax,%rbx
lea    0xe3d(%rip),%rdi
mov    $0x1,%esi
call   1070 <startParagraph@plt>
mov    %rbx,%rdi
call   1050 <ConvertString@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10c0 <CmdEndParagraph@plt>
test   %r14,%r14
je     123a <CmdSubFigure+0x9a>
lea    0xe10(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1070 <startParagraph@plt>
mov    %rbx,%rdi
call   1080 <getCounter@plt>
add    $0x61,%al
movsbl %al,%esi
lea    0xdf9(%rip),%rdi
call   10a0 <fprintRTF@plt>
mov    %r14,%rdi
call   1050 <ConvertString@plt>
xor    %edi,%edi
call   10c0 <CmdEndParagraph@plt>
mov    %r14,%rdi
call   1030 <free@plt>
lea    0xdcc(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    10b0 <incrementCounter@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"CmdSubFigure\00"
@.str.1 = [10 x i8] c"subfigure\00"
@.str.2 = [6 x i8] c"(%c) \00"
define void @CmdSubFigure(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %2
%6 = call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = call i8* (...) @getBracketParam()
store i8* %7, i8** %3
%8 = call i8* (...) @getBraceParam()
store i8* %8, i8** %4
%9 = call i32 @startParagraph(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1)
%10 = load i8*, i8** %4
%11 = call i32 @ConvertString(i8* %10)
%12 = load i8*, i8** %4
%13 = call i32 @free(i8* %12)
%14 = call i32 @CmdEndParagraph(i32 0)
%15 = load i8*, i8** %3
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %29
17: ; preds = %1
%18 = call i32 @startParagraph(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1)
%19 = call i32 @getCounter(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 97
%22 = trunc i32 %21 to i8
%23 = call i32 @fprintRTF(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 signext %22)
%24 = load i8*, i8** %3
%25 = call i32 @ConvertString(i8* %24)
%26 = call i32 @CmdEndParagraph(i32 0)
%27 = load i8*, i8** %3
%28 = call i32 @free(i8* %27)
br label %29
29: ; preds = %17, %1
%30 = call i32 @incrementCounter(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"CmdSubFigure\00"
@.str.1 = [10 x i8] c"subfigure\00"
@.str.2 = [6 x i8] c"(%c) \00"
define void @CmdSubFigure(i32 %0) {
%2 = tail call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* (...) @getBracketParam()
%4 = tail call i8* (...) @getBraceParam()
%5 = tail call i32 @startParagraph(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1)
%6 = tail call i32 @ConvertString(i8* %4)
%7 = tail call i32 @free(i8* %4)
%8 = tail call i32 @CmdEndParagraph(i32 0)
%9 = icmp eq i8* %3, null
br i1 %9, label %19, label %10
10: ; preds = %1
%11 = tail call i32 @startParagraph(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1)
%12 = tail call i32 @getCounter(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%13 = trunc i32 %12 to i8
%14 = add i8 %13, 97
%15 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 signext %14)
%16 = tail call i32 @ConvertString(i8* %3)
%17 = tail call i32 @CmdEndParagraph(i32 0)
%18 = tail call i32 @free(i8* %3)
br label %19
19: ; preds = %10, %1
%20 = tail call i32 @incrementCounter(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}