#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 */
struct toktable2 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_token2_in_file(int, unsigned int, char *,
                                      struct toktable2 *, int);
char *strchr(char *, char);
void add_angled_terms(int file_index, unsigned int hash_key,
                      struct toktable2 *table, int add_to_chain1, char *s) {
  char *left, *right;
  if (s) {
    left = strchr(s, '<');
    while (left) {
      right = strchr(left, '>');
      if (right) {
        *right = '\0';
        add_token2_in_file(file_index, hash_key, left + 1, table,
                           add_to_chain1);
        *right = '>';
      } else {
        break;
      }
      left = strchr(right, '<');
    }
  }
}


x86 assembly (clang, -O0):
<add_angled_terms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11cd <add_angled_terms+0xad>
mov    -0x20(%rbp),%rdi
mov    $0x3c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11c8 <add_angled_terms+0xa8>
mov    -0x28(%rbp),%rdi
mov    $0x3e,%esi
call   1030 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11ac <add_angled_terms+0x8c>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x28(%rbp),%rdx
add    $0x1,%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
call   1040 <add_token2_in_file@plt>
mov    -0x30(%rbp),%rax
movb   $0x3e,(%rax)
jmp    11b1 <add_angled_terms+0x91>
jmp    11c8 <add_angled_terms+0xa8>
mov    -0x30(%rbp),%rdi
mov    $0x3c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
jmp    1156 <add_angled_terms+0x36>
jmp    11cd <add_angled_terms+0xad>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_angled_terms>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %r8,%r8
je     11a8 <add_angled_terms+0x88>
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %esi,%r12d
mov    %edi,%r13d
mov    %r8,%rdi
mov    $0x3c,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11a8 <add_angled_terms+0x88>
mov    %rax,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    $0x3e,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11a8 <add_angled_terms+0x88>
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0x1,%rbp
mov    %r13d,%edi
mov    %r12d,%esi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14d,%r8d
call   1040 <add_token2_in_file@plt>
movb   $0x3e,(%rbx)
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1030 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1160 <add_angled_terms+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.toktable2 = type { i32 }
define void @add_angled_terms(i32 %0, i32 %1, %struct.toktable2* %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.toktable2*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store %struct.toktable2* %2, %struct.toktable2** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%13 = load i8*, i8** %10
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %41
15: ; preds = %5
%16 = load i8*, i8** %10
%17 = call i8* @strchr(i8* %16, i8 signext 60)
store i8* %17, i8** %11
br label %18
18: ; preds = %37, %15
%19 = load i8*, i8** %11
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %40
21: ; preds = %18
%22 = load i8*, i8** %11
%23 = call i8* @strchr(i8* %22, i8 signext 62)
store i8* %23, i8** %12
%24 = load i8*, i8** %12
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %36
26: ; preds = %21
%27 = load i8*, i8** %12
store i8 0, i8* %27
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = load i8*, i8** %11
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load %struct.toktable2*, %struct.toktable2** %8
%33 = load i32, i32* %9
%34 = call i32 @add_token2_in_file(i32 %28, i32 %29, i8* %31, %struct.toktable2* %32, i32 %33)
%35 = load i8*, i8** %12
store i8 62, i8* %35
br label %37
36: ; preds = %21
br label %40
37: ; preds = %26
%38 = load i8*, i8** %12
%39 = call i8* @strchr(i8* %38, i8 signext 60)
store i8* %39, i8** %11
br label %18
40: ; preds = %36, %18
br label %41
41: ; preds = %40, %5
ret void
}

LLVM IR (-O2):
%struct.toktable2 = type { i32 }
define void @add_angled_terms(i32 %0, i32 %1, %struct.toktable2* %2, i32 %3, i8* %4) {
%6 = icmp eq i8* %4, null
br i1 %6, label %19, label %7
7: ; preds = %5
%8 = tail call i8* @strchr(i8* %4, i8 signext 60)
%9 = icmp eq i8* %8, null
br i1 %9, label %19, label %10
10: ; preds = %7, %14
%11 = phi i8* [ %17, %14 ], [ %8, %7 ]
%12 = tail call i8* @strchr(i8* %11, i8 signext 62)
%13 = icmp eq i8* %12, null
br i1 %13, label %19, label %14
14: ; preds = %10
store i8 0, i8* %12
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = tail call i32 @add_token2_in_file(i32 %0, i32 %1, i8* %15, %struct.toktable2* %2, i32 %3)
store i8 62, i8* %12
%17 = tail call i8* @strchr(i8* %12, i8 signext 60)
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %10
19: ; preds = %10, %14, %7, %5
ret void
}