#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 dyn_string_str {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dyn_strcat(struct dyn_string_str *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char, char, long, char, char, long,
                           char);
void add_annot_code(int have_ann, char sp0, char sp1, char ann_aa1_i1,
                    long q_off_pos, long l_off_pos, char sim_sym_code,
                    struct dyn_string_str *ann_code_dyn) {
  char ann_ch0, ann_ch1;
  char tmp_astr[512];
  ann_ch0 = ann_ch1 = '\0';
  if (have_ann && ann_aa1_i1 != ' ') {
    ann_ch0 = 'X';
    ann_ch1 = ann_aa1_i1;
  } else {
    return;
  }
  if (!(ann_ch1 == '[' || ann_ch1 == ']')) {
    sprintf(tmp_astr, "|%c%c:%ld%c%c%ld%c", ann_ch0, ann_ch1, q_off_pos + 1,
            sp0, sim_sym_code, l_off_pos + 1, sp1);
    dyn_strcat(ann_code_dyn, tmp_astr);
  }
}


x86 assembly (clang, -O0):
<add_annot_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    0x18(%rbp),%rsi
mov    0x10(%rbp),%sil
mov    %edi,-0x4(%rbp)
mov    %dl,-0x5(%rbp)
mov    %cl,-0x6(%rbp)
mov    %al,-0x7(%rbp)
mov    %r8,-0x10(%rbp)
mov    %r9,-0x18(%rbp)
movb   $0x0,-0x1a(%rbp)
movb   $0x0,-0x19(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     117c <add_annot_code+0x5c>
movsbl -0x7(%rbp),%eax
cmp    $0x20,%eax
je     117c <add_annot_code+0x5c>
movb   $0x58,-0x19(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0x1a(%rbp)
jmp    1181 <add_annot_code+0x61>
jmp    11fb <add_annot_code+0xdb>
movsbl -0x1a(%rbp),%eax
cmp    $0x5b,%eax
je     11fb <add_annot_code+0xdb>
movsbl -0x1a(%rbp),%eax
cmp    $0x5d,%eax
je     11fb <add_annot_code+0xdb>
lea    -0x220(%rbp),%rdi
mov    -0x19(%rbp),%dl
mov    -0x1a(%rbp),%cl
mov    -0x10(%rbp),%r8
add    $0x1,%r8
mov    -0x5(%rbp),%r9b
mov    0x10(%rbp),%r10b
mov    -0x18(%rbp),%rax
add    $0x1,%rax
lea    0xe39(%rip),%rsi
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
movsbl -0x6(%rbp),%eax
mov    %eax,0x10(%rsp)
call   1040 <sprintf@plt>
mov    0x18(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1030 <dyn_strcat@plt>
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_annot_code>:
test   %edi,%edi
je     1133 <add_annot_code+0x13>
cmp    $0x20,%cl
je     1133 <add_annot_code+0x13>
cmp    $0x5b,%cl
je     1133 <add_annot_code+0x13>
cmp    $0x5d,%cl
jne    1134 <add_annot_code+0x14>
ret
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %r9,%rax
mov    0x228(%rsp),%r14
mov    0x220(%rsp),%dil
add    $0x1,%r8
add    $0x1,%rax
sub    $0x8,%rsp
movsbl %dl,%ebx
movsbl %dil,%r10d
movsbl %cl,%ecx
movsbl %sil,%r9d
lea    0xe8c(%rip),%rsi
lea    0x8(%rsp),%r15
mov    %r15,%rdi
mov    $0x58,%edx
push   %rbx
push   %rax
push   %r10
call   1040 <sprintf@plt>
add    $0x20,%rsp
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <dyn_strcat@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.dyn_string_str = type { i32 }
@.str = [19 x i8] c"|%c%c:%ld%c%c%ld%c\00"
define void @add_annot_code(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3, i64 %4, i64 %5, i8 signext %6, %struct.dyn_string_str* %7) {
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i64
%14 = alloca i64
%15 = alloca i8
%16 = alloca %struct.dyn_string_str*
%17 = alloca i8
%18 = alloca i8
%19 = alloca [512 x i8]
store i32 %0, i32* %9
store i8 %1, i8* %10
store i8 %2, i8* %11
store i8 %3, i8* %12
store i64 %4, i64* %13
store i64 %5, i64* %14
store i8 %6, i8* %15
store %struct.dyn_string_str* %7, %struct.dyn_string_str** %16
store i8 0, i8* %18
store i8 0, i8* %17
%20 = load i32, i32* %9
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %8
%23 = load i8, i8* %12
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 32
br i1 %25, label %26, label %28
26: ; preds = %22
store i8 88, i8* %17
%27 = load i8, i8* %12
store i8 %27, i8* %18
br label %29
28: ; preds = %22, %8
br label %52
29: ; preds = %26
%30 = load i8, i8* %18
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 91
br i1 %32, label %52, label %33
33: ; preds = %29
%34 = load i8, i8* %18
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 93
br i1 %36, label %52, label %37
37: ; preds = %33
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%39 = load i8, i8* %17
%40 = load i8, i8* %18
%41 = load i64, i64* %13
%42 = add nsw i64 %41, 1
%43 = load i8, i8* %10
%44 = load i8, i8* %15
%45 = load i64, i64* %14
%46 = add nsw i64 %45, 1
%47 = load i8, i8* %11
%48 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 signext %39, i8 signext %40, i64 %42, i8 signext %43, i8 signext %44, i64 %46, i8 signext %47)
%49 = load %struct.dyn_string_str*, %struct.dyn_string_str** %16
%50 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%51 = call i32 @dyn_strcat(%struct.dyn_string_str* %49, i8* %50)
br label %52
52: ; preds = %28, %37, %33, %29
ret void
}

LLVM IR (-O2):
%struct.dyn_string_str = type { i32 }
@.str = [19 x i8] c"|%c%c:%ld%c%c%ld%c\00"
define void @add_annot_code(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3, i64 %4, i64 %5, i8 signext %6, %struct.dyn_string_str* %7) {
%9 = alloca [512 x i8]
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%11 = icmp ne i32 %0, 0
%12 = icmp ne i8 %3, 32
%13 = and i1 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %8
switch i8 %3, label %15 [
i8 93, label %20
i8 91, label %20
]
15: ; preds = %14
%16 = add nsw i64 %4, 1
%17 = add nsw i64 %5, 1
%18 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 signext 88, i8 signext %3, i64 %16, i8 signext %1, i8 signext %6, i64 %17, i8 signext %2)
%19 = call i32 @dyn_strcat(%struct.dyn_string_str* %7, i8* %10)
br label %20
20: ; preds = %15, %14, %14, %8
ret void
}