#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
char *anchor_generator() {
  static int val = 1;
  char buf[5];
  char title[7];
  sprintf(buf, "%d", val);
  val++;
  strcpy(title, "H_");
  strcat(title, buf);
  return strdup(title);
}


x86 assembly (clang, -O0):
<anchor_generator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x5(%rbp),%rdi
mov    0x2eee(%rip),%edx
lea    0xea7(%rip),%rsi
call   1050 <sprintf@plt>
mov    0x2edc(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ed3(%rip)
lea    -0xc(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xc(%rbp),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <strcat@plt>
lea    -0xc(%rbp),%rdi
call   1060 <strdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anchor_generator>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2ef3(%rip),%edx
lea    0xeac(%rip),%rsi
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1050 <sprintf@plt>
addl   $0x1,0x2ed8(%rip)
lea    0xe94(%rip),%rsi
lea    0x11(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
mov    %rbx,%rdi
call   1060 <strdup@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@anchor_generator.val = internal global i32 1
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"H_\00"
define i8* @anchor_generator() {
%1 = alloca [5 x i8]
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @anchor_generator.val
%5 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @anchor_generator.val
%7 = add nsw i32 %6, 1
store i32 %7, i32* @anchor_generator.val
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%12 = call i32 @strcat(i8* %10, i8* %11)
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%14 = call i8* @strdup(i8* %13)
ret i8* %14
}

LLVM IR (-O2):
@anchor_generator.val = internal unnamed_addr global i32 1
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"H_\00"
define noalias i8* @anchor_generator() {
%1 = alloca [5 x i8]
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @anchor_generator.val
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @anchor_generator.val
%8 = add nsw i32 %7, 1
store i32 %8, i32* @anchor_generator.val
%9 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @strcat(i8* %4, i8* %3)
%11 = call i8* @strdup(i8* %4)
ret i8* %11
}