#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 *computeIntersection(char *, char *);
char *parseSet(char *);
int /*<<< orphan*/ string_remove_char(char *, int /*<<< orphan*/);
scalar_t__ strlen(char *);
char *parseIntersection(char *expression) {
  char *value1 = parseSet(expression);
  while (strlen(expression) > 0) {
    char symbol = expression[0];
    if (symbol != '*') {
      return value1;
    }
    string_remove_char(expression, 0);
    char *value2 = parseSet(expression);
    value1 = computeIntersection(value1, value2);
  }
  return value1;
}


x86 assembly (clang, -O0):
<parseIntersection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <parseSet@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jle    11bd <parseIntersection+0x7d>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x2a,%eax
je     118f <parseIntersection+0x4f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11c5 <parseIntersection+0x85>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1050 <string_remove_char@plt>
mov    -0x10(%rbp),%rdi
call   1030 <parseSet@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <computeIntersection@plt>
mov    %rax,-0x18(%rbp)
jmp    1159 <parseIntersection+0x19>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseIntersection>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <parseSet@plt>
nopl   0x0(%rax)
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jle    1184 <parseIntersection+0x44>
cmpb   $0x2a,(%rbx)
jne    1184 <parseIntersection+0x44>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <string_remove_char@plt>
mov    %rbx,%rdi
call   1030 <parseSet@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <computeIntersection@plt>
jmp    1150 <parseIntersection+0x10>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @parseIntersection(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* @parseSet(i8* %7)
store i8* %8, i8** %4
br label %9
9: ; preds = %22, %1
%10 = load i8*, i8** %3
%11 = call i64 @strlen(i8* %10)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
store i8 %16, i8* %5
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 42
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = load i8*, i8** %4
store i8* %21, i8** %2
br label %32
22: ; preds = %13
%23 = load i8*, i8** %3
%24 = call i32 @string_remove_char(i8* %23, i32 0)
%25 = load i8*, i8** %3
%26 = call i8* @parseSet(i8* %25)
store i8* %26, i8** %6
%27 = load i8*, i8** %4
%28 = load i8*, i8** %6
%29 = call i8* @computeIntersection(i8* %27, i8* %28)
store i8* %29, i8** %4
br label %9
30: ; preds = %9
%31 = load i8*, i8** %4
store i8* %31, i8** %2
br label %32
32: ; preds = %30, %20
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
define i8* @parseIntersection(i8* %0) {
%2 = tail call i8* @parseSet(i8* %0)
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %1, %9
%6 = phi i8* [ %12, %9 ], [ %2, %1 ]
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 42
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = tail call i32 @string_remove_char(i8* %0, i32 0)
%11 = tail call i8* @parseSet(i8* %0)
%12 = tail call i8* @computeIntersection(i8* %6, i8* %11)
%13 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%14 = icmp sgt i64 %13, 0
br i1 %14, label %5, label %15
15: ; preds = %9, %5, %1
%16 = phi i8* [ %2, %1 ], [ %6, %5 ], [ %12, %9 ]
ret i8* %16
}