#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 */
char *parseBlock(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ string_insert_char(char *, char, int /*<<< orphan*/);
char *string_new();
int /*<<< orphan*/ string_remove_char(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
char *parseSet(char *expression) {
  char *value = parseBlock(expression);
  char *result = string_new();
  strcat(result, value);
  if (strlen(expression) > 0) {
    char symbol = expression[0];
    if (symbol != '{') {
      return value;
    }
    do {
      symbol = expression[0];
      string_insert_char(result, symbol, strlen(result));
      string_remove_char(expression, 0);
    } while (symbol != '}');
  }
  return result;
}


x86 assembly (clang, -O0):
<parseSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <parseBlock@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <string_new@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
jle    1219 <parseSet+0xb9>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x7b,%eax
je     11c6 <parseSet+0x66>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <parseSet+0xc1>
jmp    11cb <parseSet+0x6b>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x21(%rbp),%al
mov    %al,-0x22(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
mov    -0x22(%rbp),%al
movsbl %al,%esi
call   1050 <string_insert_char@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1060 <string_remove_char@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x7d,%eax
jne    11cb <parseSet+0x6b>
jmp    1219 <parseSet+0xb9>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseSet>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1070 <parseBlock@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1030 <string_new@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1080 <strcat@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11e7 <parseSet+0x87>
cmpb   $0x7b,(%r14)
jne    11ea <parseSet+0x8a>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    $0x7b,%esi
mov    %eax,%edx
call   1050 <string_insert_char@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <string_remove_char@plt>
nopw   0x0(%rax,%rax,1)
movsbl (%r14),%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <string_insert_char@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <string_remove_char@plt>
cmp    $0x7d,%ebp
jne    11c0 <parseSet+0x60>
mov    %rbx,%r15
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @parseSet(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @parseBlock(i8* %7)
store i8* %8, i8** %4
%9 = call i8* (...) @string_new()
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %4
%12 = call i32 @strcat(i8* %10, i8* %11)
%13 = load i8*, i8** %3
%14 = call i32 @strlen(i8* %13)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %42
16: ; preds = %1
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
store i8 %19, i8* %6
%20 = load i8, i8* %6
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 123
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = load i8*, i8** %4
store i8* %24, i8** %2
br label %44
25: ; preds = %16
br label %26
26: ; preds = %37, %25
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
store i8 %29, i8* %6
%30 = load i8*, i8** %5
%31 = load i8, i8* %6
%32 = load i8*, i8** %5
%33 = call i32 @strlen(i8* %32)
%34 = call i32 @string_insert_char(i8* %30, i8 signext %31, i32 %33)
%35 = load i8*, i8** %3
%36 = call i32 @string_remove_char(i8* %35, i32 0)
br label %37
37: ; preds = %26
%38 = load i8, i8* %6
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, 125
br i1 %40, label %26, label %41
41: ; preds = %37
br label %42
42: ; preds = %41, %1
%43 = load i8*, i8** %5
store i8* %43, i8** %2
br label %44
44: ; preds = %42, %23
%45 = load i8*, i8** %2
ret i8* %45
}

LLVM IR (-O2):
define i8* @parseSet(i8* %0) {
%2 = tail call i8* @parseBlock(i8* %0)
%3 = tail call i8* (...) @string_new()
%4 = tail call i32 @strcat(i8* %3, i8* %2)
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %1
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 123
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = tail call i32 @strlen(i8* %3)
%12 = tail call i32 @string_insert_char(i8* %3, i8 signext 123, i32 %11)
%13 = tail call i32 @string_remove_char(i8* %0, i32 0)
br label %14
14: ; preds = %10, %14
%15 = load i8, i8* %0
%16 = tail call i32 @strlen(i8* %3)
%17 = tail call i32 @string_insert_char(i8* %3, i8 signext %15, i32 %16)
%18 = tail call i32 @string_remove_char(i8* %0, i32 0)
%19 = icmp eq i8 %15, 125
br i1 %19, label %20, label %14
20: ; preds = %14, %1, %7
%21 = phi i8* [ %2, %7 ], [ %3, %1 ], [ %3, %14 ]
ret i8* %21
}