#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*/ fprintf(int /*<<< orphan*/, char *, char *, int,
                           unsigned char *, char, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *strchr(char *, char);
int strlen(char *);
int add_annot_char(unsigned char *ann_arr, char ctmp_label) {
  int i_ann;
  if (ann_arr[0] == '\0') {
    ann_arr[0] = ' ';
    ann_arr[1] = '\0';
  }
  if (strchr((char *)ann_arr, ctmp_label) == NULL) {
    if (strlen((char *)ann_arr) >= 120) {
      fprintf(stderr,
              "*** ERROR [%s:%d] -  too many annotation characters: len(%s) + "
              "%c > %d\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/uwbmrb/BMRB-API/refs/heads/master/"
              "server/wsgi/bmrbapi/submodules/fasta36/src/compacc2.c",
              2123, ann_arr, ctmp_label, 120 - 1);
      return 0;
    } else {
      ann_arr[i_ann = strlen((char *)ann_arr)] = ctmp_label;
      ann_arr[i_ann + 1] = '\0';
      return i_ann;
    }
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<add_annot_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
jne    1161 <add_annot_char+0x31>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    120c <add_annot_char+0xdc>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x78,%eax
jl     11c7 <add_annot_char+0x97>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%r8
lea    0xe62(%rip),%rsi
lea    0xea3(%rip),%rdx
mov    $0x84b,%ecx
movsbl -0x11(%rbp),%r9d
movl   $0x77,(%rsp)
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1213 <add_annot_char+0xe3>
mov    -0x11(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x21(%rbp),%dl
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1213 <add_annot_char+0xe3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_annot_char>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
jne    1147 <add_annot_char+0x17>
movw   $0x20,(%rbx)
movsbl %r15b,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <strchr@plt>
xor    %r14d,%r14d
test   %rax,%rax
jne    11b0 <add_annot_char+0x80>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x78,%eax
jl     119a <add_annot_char+0x6a>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
movl   $0x77,(%rsp)
lea    0xe7f(%rip),%rsi
lea    0xec0(%rip),%rdx
mov    $0x84b,%ecx
mov    %rbx,%r8
mov    %ebp,%r9d
call   1050 <fprintf@plt>
jmp    11b0 <add_annot_char+0x80>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
cltq
mov    %r15b,(%rbx,%rax,1)
movb   $0x0,0x1(%rbx,%rax,1)
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [72 x i8] c"*** ERROR [%s:%d] - too many annotation characters: len(%s) + %c > %d\0A\00"
@.str.1 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/uwbmrb/BMRB-API/refs/heads/master/server/wsgi/bmrbapi/submodules/fasta36/src/compacc2.c\00"
define i32 @add_annot_char(i8* %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
store i8* %0, i8** %4
store i8 %1, i8* %5
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 32, i8* %14
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 0, i8* %16
br label %17
17: ; preds = %12, %2
%18 = load i8*, i8** %4
%19 = load i8, i8* %5
%20 = call i32* @strchr(i8* %18, i8 signext %19)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %44
22: ; preds = %17
%23 = load i8*, i8** %4
%24 = call i32 @strlen(i8* %23)
%25 = icmp sge i32 %24, 120
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %4
%29 = load i8, i8* %5
%30 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 2123, i8* %28, i8 signext %29, i32 119)
store i32 0, i32* %3
br label %45
31: ; preds = %22
%32 = load i8, i8* %5
%33 = load i8*, i8** %4
%34 = load i8*, i8** %4
%35 = call i32 @strlen(i8* %34)
store i32 %35, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
store i8 %32, i8* %37
%38 = load i8*, i8** %4
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %38, i64 %41
store i8 0, i8* %42
%43 = load i32, i32* %6
store i32 %43, i32* %3
br label %45
44: ; preds = %17
store i32 0, i32* %3
br label %45
45: ; preds = %44, %31, %26
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [72 x i8] c"*** ERROR [%s:%d] - too many annotation characters: len(%s) + %c > %d\0A\00"
@.str.1 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/uwbmrb/BMRB-API/refs/heads/master/server/wsgi/bmrbapi/submodules/fasta36/src/compacc2.c\00"
define i32 @add_annot_char(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
store i8 32, i8* %0
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 0, i8* %6
br label %7
7: ; preds = %5, %2
%8 = tail call i32* @strchr(i8* %0, i8 signext %1)
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = tail call i32 @strlen(i8* %0)
%12 = icmp sgt i32 %11, 119
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 2123, i8* %0, i8 signext %1, i32 119)
br label %23
16: ; preds = %10
%17 = tail call i32 @strlen(i8* %0)
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %0, i64 %18
store i8 %1, i8* %19
%20 = add nsw i32 %17, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %7, %16, %13
%24 = phi i32 [ 0, %13 ], [ %17, %16 ], [ 0, %7 ]
ret i32 %24
}