void update_eq_name() {
  char buffer[27];
  char *n = equalizer_current_eqname();
  int l = strlen(n);
  if (l > 14) {
    n[14] = 0;
    n[13] = '.';
    n[12] = '.';
    n[11] = '.';
  }
  sprintf(buffer, "EQ set to: %s", n);
  internal_logit(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/server.c",
      1285, __FUNCTION__, "%s", buffer);
  free(n);
  status_msg(buffer);
}


x86 assembly (clang, -O0):
<update_eq_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1060 <equalizer_current_eqname@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xe,-0x2c(%rbp)
jle    11ab <update_eq_name+0x4b>
mov    -0x28(%rbp),%rax
movb   $0x0,0xe(%rax)
mov    -0x28(%rbp),%rax
movb   $0x2e,0xd(%rax)
mov    -0x28(%rbp),%rax
movb   $0x2e,0xc(%rax)
mov    -0x28(%rbp),%rax
movb   $0x2e,0xb(%rax)
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%r8
lea    0xe42(%rip),%rdi
mov    $0x505,%esi
lea    0xebe(%rip),%rdx
lea    0xe2c(%rip),%rcx
mov    $0x0,%al
call   1070 <internal_logit@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1080 <status_msg@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_eq_name>:
push   %r14
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   1060 <equalizer_current_eqname@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0xf,%eax
jl     1185 <update_eq_name+0x25>
movl   $0x2e2e2e,0xb(%rbx)
lea    0xe74(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <sprintf@plt>
lea    0xe6b(%rip),%rdi
lea    0xeec(%rip),%rdx
lea    0xe5a(%rip),%rcx
mov    $0x505,%esi
mov    %r14,%r8
xor    %eax,%eax
call   1070 <internal_logit@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <status_msg@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"EQ set to: %s\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/server.c\00"
@__FUNCTION__.update_eq_name = [15 x i8] c"update_eq_name\00"
@.str.2 = [3 x i8] c"%s\00"
define void @update_eq_name() {
%1 = alloca [27 x i8]
%2 = alloca i8*
%3 = alloca i32
%4 = call i32 (...) @equalizer_current_eqname()
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 14
br i1 %11, label %12, label %21
12: ; preds = %0
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 14
store i8 0, i8* %14
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 13
store i8 46, i8* %16
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 12
store i8 46, i8* %18
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 11
store i8 46, i8* %20
br label %21
21: ; preds = %12, %0
%22 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%23 = load i8*, i8** %2
%24 = call i32 (i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%26 = call i32 (i8*, i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @internal_logit to i32 (i8*, i32, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 1285, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.update_eq_name, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %2
%28 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @status_msg to i32 (i8*, ...)*)(i8* %28)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"EQ set to: %s\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/server.c\00"
@__FUNCTION__.update_eq_name = [15 x i8] c"update_eq_name\00"
@.str.2 = [3 x i8] c"%s\00"
define void @update_eq_name() {
%1 = alloca [27 x i8]
%2 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @equalizer_current_eqname()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%7 = trunc i64 %6 to i32
%8 = icmp sgt i32 %7, 14
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = getelementptr inbounds i8, i8* %5, i64 14
store i8 0, i8* %10
%11 = getelementptr inbounds i8, i8* %5, i64 13
store i8 46, i8* %11
%12 = getelementptr inbounds i8, i8* %5, i64 12
store i8 46, i8* %12
%13 = getelementptr inbounds i8, i8* %5, i64 11
store i8 46, i8* %13
br label %14
14: ; preds = %9, %0
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %5)
%16 = call i32 (i8*, i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @internal_logit to i32 (i8*, i32, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 1285, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.update_eq_name, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @status_msg to i32 (i8*, ...)*)(i8* %2)
ret void
}