#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*/ ConvertString(char *);
long atoi(char *);
int /*<<< orphan*/ diagnostics(int, char *, ...);
int /*<<< orphan*/ fprintRTF(char *);
int /*<<< orphan*/ free(char *);
char *getBraceParam();
char *strdup_noendblanks(char *);
void CmdMultiCol(int code) {
  long numCol, i;
  char *num, *format, *content, *bcontent;
  num = getBraceParam();
  format = getBraceParam();
  bcontent = getBraceParam();
  content = strdup_noendblanks(bcontent);
  free(bcontent);
  diagnostics(4, "CmdMultiCol cols=%s format=<%s> content=<%s>", num, format,
              content);
  numCol = atoi(num);
  free(num);
  diagnostics(4, "Entering Convert() from CmdMultiCol()");
  ConvertString(content);
  diagnostics(4, "Exiting Convert() from CmdMultiCol()");
  for (i = 1; i < numCol; i++) {
    fprintRTF("\\cell}\n");
    fprintRTF("{\\pard\\intbl");
  }
  free(content);
  free(format);
}


x86 assembly (clang, -O0):
<CmdMultiCol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getBraceParam@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1050 <getBraceParam@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1050 <getBraceParam@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strdup_noendblanks@plt>
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    $0x4,%edi
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1070 <diagnostics@plt>
mov    -0x20(%rbp),%rdi
call   1090 <atoi@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x4,%edi
lea    0xe3a(%rip),%rsi
mov    $0x0,%al
call   1070 <diagnostics@plt>
mov    -0x30(%rbp),%rdi
call   1060 <ConvertString@plt>
mov    $0x4,%edi
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1070 <diagnostics@plt>
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1255 <CmdMultiCol+0xe5>
lea    0xe45(%rip),%rdi
call   1080 <fprintRTF@plt>
lea    0xe41(%rip),%rdi
call   1080 <fprintRTF@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    121e <CmdMultiCol+0xae>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdMultiCol>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
xor    %eax,%eax
call   1050 <getBraceParam@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1050 <getBraceParam@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1050 <getBraceParam@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strdup_noendblanks@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe4f(%rip),%rsi
mov    $0x4,%edi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1070 <diagnostics@plt>
mov    %r12,%rdi
call   1090 <atoi@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1030 <free@plt>
lea    0xe4d(%rip),%rsi
mov    $0x4,%edi
xor    %eax,%eax
call   1070 <diagnostics@plt>
mov    %r15,%rdi
call   1060 <ConvertString@plt>
lea    0xe58(%rip),%rsi
mov    $0x4,%edi
xor    %eax,%eax
call   1070 <diagnostics@plt>
cmp    $0x2,%rbx
jl     1236 <CmdMultiCol+0xc6>
add    $0xffffffffffffffff,%rbx
lea    0xe60(%rip),%r12
lea    0xe61(%rip),%r13
nop
mov    %r12,%rdi
call   1080 <fprintRTF@plt>
mov    %r13,%rdi
call   1080 <fprintRTF@plt>
add    $0xffffffffffffffff,%rbx
jne    1220 <CmdMultiCol+0xb0>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"CmdMultiCol cols=%s format=<%s> content=<%s>\00"
@.str.1 = [38 x i8] c"Entering Convert() from CmdMultiCol()\00"
@.str.2 = [37 x i8] c"Exiting Convert() from CmdMultiCol()\00"
@.str.3 = [8 x i8] c"\\cell}\0A\00"
@.str.4 = [13 x i8] c"{\\pard\\intbl\00"
define void @CmdMultiCol(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %2
%9 = call i8* (...) @getBraceParam()
store i8* %9, i8** %5
%10 = call i8* (...) @getBraceParam()
store i8* %10, i8** %6
%11 = call i8* (...) @getBraceParam()
store i8* %11, i8** %8
%12 = load i8*, i8** %8
%13 = call i8* @strdup_noendblanks(i8* %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %8
%15 = call i32 @free(i8* %14)
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = load i8*, i8** %7
%19 = call i32 (i32, i8*, ...) @diagnostics(i32 4, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17, i8* %18)
%20 = load i8*, i8** %5
%21 = call i64 @atoi(i8* %20)
store i64 %21, i64* %3
%22 = load i8*, i8** %5
%23 = call i32 @free(i8* %22)
%24 = call i32 (i32, i8*, ...) @diagnostics(i32 4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%25 = load i8*, i8** %7
%26 = call i32 @ConvertString(i8* %25)
%27 = call i32 (i32, i8*, ...) @diagnostics(i32 4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
store i64 1, i64* %4
br label %28
28: ; preds = %35, %1
%29 = load i64, i64* %4
%30 = load i64, i64* %3
%31 = icmp slt i64 %29, %30
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = call i32 @fprintRTF(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%34 = call i32 @fprintRTF(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %32
%36 = load i64, i64* %4
%37 = add nsw i64 %36, 1
store i64 %37, i64* %4
br label %28
38: ; preds = %28
%39 = load i8*, i8** %7
%40 = call i32 @free(i8* %39)
%41 = load i8*, i8** %6
%42 = call i32 @free(i8* %41)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"CmdMultiCol cols=%s format=<%s> content=<%s>\00"
@.str.1 = [38 x i8] c"Entering Convert() from CmdMultiCol()\00"
@.str.2 = [37 x i8] c"Exiting Convert() from CmdMultiCol()\00"
@.str.3 = [8 x i8] c"\\cell}\0A\00"
@.str.4 = [13 x i8] c"{\\pard\\intbl\00"
define void @CmdMultiCol(i32 %0) {
%2 = tail call i8* (...) @getBraceParam()
%3 = tail call i8* (...) @getBraceParam()
%4 = tail call i8* (...) @getBraceParam()
%5 = tail call i8* @strdup_noendblanks(i8* %4)
%6 = tail call i32 @free(i8* %4)
%7 = tail call i32 (i32, i8*, ...) @diagnostics(i32 4, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i8* %5)
%8 = tail call i64 @atoi(i8* %2)
%9 = tail call i32 @free(i8* %2)
%10 = tail call i32 (i32, i8*, ...) @diagnostics(i32 4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @ConvertString(i8* %5)
%12 = tail call i32 (i32, i8*, ...) @diagnostics(i32 4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp sgt i64 %8, 1
br i1 %13, label %14, label %20
14: ; preds = %1, %14
%15 = phi i64 [ %18, %14 ], [ 1, %1 ]
%16 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%17 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%18 = add nuw nsw i64 %15, 1
%19 = icmp eq i64 %18, %8
br i1 %19, label %20, label %14
20: ; preds = %14, %1
%21 = tail call i32 @free(i8* %5)
%22 = tail call i32 @free(i8* %3)
ret void
}