#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*/ PopSource();
int /*<<< orphan*/ PushSource(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ free(char *);
char *getBraceParam();
char *strdup_noendblanks(char *);
int strlen(char const *);
char *strstr(char const *, char *);
int TabularMeasureCell(const char *cell) {
  char *s;
  int len;
  if (cell == NULL || *cell == '\0')
    return 0;
  s = strstr(cell, "multicolumn");
  if (s) {
    char *num, *format, *text, *xtext;
    PushSource(NULL, s + strlen("multicolumn"));
    num = getBraceParam();
    format = getBraceParam();
    text = getBraceParam();
    PopSource();
    xtext = strdup_noendblanks(text);
    len = (int)strlen(xtext);
    free(num);
    free(format);
    free(text);
    free(xtext);
    return len;
  }
  return (int)strlen(cell);
}


x86 assembly (clang, -O0):
<TabularMeasureCell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1197 <TabularMeasureCell+0x27>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11a3 <TabularMeasureCell+0x33>
movl   $0x0,-0x4(%rbp)
jmp    1264 <TabularMeasureCell+0xf4>
mov    -0x10(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1090 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1258 <TabularMeasureCell+0xe8>
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xe2f(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x48(%rbp),%rsi
cltq
add    %rax,%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1070 <PushSource@plt>
mov    $0x0,%al
call   1060 <getBraceParam@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1060 <getBraceParam@plt>
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1060 <getBraceParam@plt>
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1080 <PopSource@plt>
mov    -0x38(%rbp),%rdi
call   1040 <strdup_noendblanks@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1264 <TabularMeasureCell+0xf4>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TabularMeasureCell>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rdi,%rdi
je     1221 <TabularMeasureCell+0xb1>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1221 <TabularMeasureCell+0xb1>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strstr@plt>
test   %rax,%rax
je     122c <TabularMeasureCell+0xbc>
mov    %rax,%r14
lea    0xe51(%rip),%rdi
call   1050 <strlen@plt>
cltq
add    %rax,%r14
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <PushSource@plt>
xor    %eax,%eax
call   1060 <getBraceParam@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1060 <getBraceParam@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1060 <getBraceParam@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1080 <PopSource@plt>
mov    %r12,%rdi
call   1040 <strdup_noendblanks@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
jmp    1223 <TabularMeasureCell+0xb3>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <strlen@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"multicolumn\00"
define i32 @TabularMeasureCell(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %3
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %17, label %12
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12, %1
store i32 0, i32* %2
br label %49
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = call i8* @strstr(i8* %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %20, i8** %4
%21 = load i8*, i8** %4
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %46
23: ; preds = %18
%24 = load i8*, i8** %4
%25 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = call i32 @PushSource(i32* null, i8* %27)
%29 = call i8* (...) @getBraceParam()
store i8* %29, i8** %6
%30 = call i8* (...) @getBraceParam()
store i8* %30, i8** %7
%31 = call i8* (...) @getBraceParam()
store i8* %31, i8** %8
%32 = call i32 (...) @PopSource()
%33 = load i8*, i8** %8
%34 = call i8* @strdup_noendblanks(i8* %33)
store i8* %34, i8** %9
%35 = load i8*, i8** %9
%36 = call i32 @strlen(i8* %35)
store i32 %36, i32* %5
%37 = load i8*, i8** %6
%38 = call i32 @free(i8* %37)
%39 = load i8*, i8** %7
%40 = call i32 @free(i8* %39)
%41 = load i8*, i8** %8
%42 = call i32 @free(i8* %41)
%43 = load i8*, i8** %9
%44 = call i32 @free(i8* %43)
%45 = load i32, i32* %5
store i32 %45, i32* %2
br label %49
46: ; preds = %18
%47 = load i8*, i8** %3
%48 = call i32 @strlen(i8* %47)
store i32 %48, i32* %2
br label %49
49: ; preds = %46, %23, %17
%50 = load i32, i32* %2
ret i32 %50
}

LLVM IR (-O2):
@.str = [12 x i8] c"multicolumn\00"
define i32 @TabularMeasureCell(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %26, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %26, label %6
6: ; preds = %3
%7 = tail call i8* @strstr(i8* %0, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %24, label %9
9: ; preds = %6
%10 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
%13 = tail call i32 @PushSource(i32* null, i8* %12)
%14 = tail call i8* (...) @getBraceParam()
%15 = tail call i8* (...) @getBraceParam()
%16 = tail call i8* (...) @getBraceParam()
%17 = tail call i32 (...) @PopSource()
%18 = tail call i8* @strdup_noendblanks(i8* %16)
%19 = tail call i32 @strlen(i8* %18)
%20 = tail call i32 @free(i8* %14)
%21 = tail call i32 @free(i8* %15)
%22 = tail call i32 @free(i8* %16)
%23 = tail call i32 @free(i8* %18)
br label %26
24: ; preds = %6
%25 = tail call i32 @strlen(i8* %0)
br label %26
26: ; preds = %1, %3, %24, %9
%27 = phi i32 [ %19, %9 ], [ %25, %24 ], [ 0, %3 ], [ 0, %1 ]
ret i32 %27
}