#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*/ assert(int /*<<< orphan*/);
double atof(char *);
int /*<<< orphan*/ exit_wrapper(int);
int /*<<< orphan*/ puts(char *);
scalar_t__ strlen(char *);
double ConvertStringToTempo(char *tempo) {
  unsigned long ctr = 0;
  double x = 0.0;
  (assert(tempo != NULL));
  for (ctr = (unsigned long)strlen(tempo); ctr > 0; ctr--) {
    if (tempo[ctr - 1] == ',') {
      tempo[ctr - 1] = '.';
      break;
    }
  }
  x = atof(tempo);
  if (x < 1.0) {
    (void)puts("Error processing source UltraStar file's tempo\nAborting");
    exit_wrapper(1);
  }
  return x;
}


x86 assembly (clang, -O0):
<ConvertStringToTempo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    11da <ConvertStringToTempo+0x8a>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    11c4 <ConvertStringToTempo+0x74>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x2e,(%rax,%rcx,1)
jmp    11da <ConvertStringToTempo+0x8a>
jmp    11c9 <ConvertStringToTempo+0x79>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    118b <ConvertStringToTempo+0x3b>
mov    -0x8(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe10(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1211 <ConvertStringToTempo+0xc1>
lea    0xe06(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit_wrapper@plt>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertStringToTempo>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
sub    $0x1,%rcx
jb     1194 <ConvertStringToTempo+0x44>
cmpb   $0x2c,-0x1(%rbx,%rax,1)
mov    %rcx,%rax
jne    1180 <ConvertStringToTempo+0x30>
movb   $0x2e,(%rbx,%rcx,1)
mov    %rbx,%rdi
call   1040 <atof@plt>
movsd  0xe5c(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11cc <ConvertStringToTempo+0x7c>
lea    0xe57(%rip),%rdi
movsd  %xmm0,0x8(%rsp)
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit_wrapper@plt>
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Error processing source UltraStar file's tempo\0AAborting\00"
define double @ConvertStringToTempo(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca double
store i8* %0, i8** %2
store i64 0, i64* %3
store double 0.000000e+00, double* %4
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8*, i8** %2
%10 = call i64 @strlen(i8* %9)
store i64 %10, i64* %3
br label %11
11: ; preds = %28, %1
%12 = load i64, i64* %3
%13 = icmp ugt i64 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i8*, i8** %2
%16 = load i64, i64* %3
%17 = sub i64 %16, 1
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 44
br i1 %21, label %22, label %27
22: ; preds = %14
%23 = load i8*, i8** %2
%24 = load i64, i64* %3
%25 = sub i64 %24, 1
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 46, i8* %26
br label %31
27: ; preds = %14
br label %28
28: ; preds = %27
%29 = load i64, i64* %3
%30 = add i64 %29, -1
store i64 %30, i64* %3
br label %11
31: ; preds = %22, %11
%32 = load i8*, i8** %2
%33 = call double @atof(i8* %32)
store double %33, double* %4
%34 = load double, double* %4
%35 = fcmp olt double %34, 1.000000e+00
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = call i32 @puts(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%38 = call i32 @exit_wrapper(i32 1)
br label %39
39: ; preds = %36, %31
%40 = load double, double* %4
ret double %40
}

LLVM IR (-O2):
@.str = [56 x i8] c"Error processing source UltraStar file's tempo\0AAborting\00"
define double @ConvertStringToTempo(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
br label %6
6: ; preds = %9, %1
%7 = phi i64 [ %5, %1 ], [ %10, %9 ]
%8 = icmp eq i64 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = add i64 %7, -1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 44
br i1 %13, label %14, label %6
14: ; preds = %9
%15 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 46, i8* %15
br label %16
16: ; preds = %6, %14
%17 = tail call double @atof(i8* %0)
%18 = fcmp olt double %17, 1.000000e+00
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%21 = tail call i32 @exit_wrapper(i32 1)
br label %22
22: ; preds = %19, %16
ret double %17
}