#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float, char *);
int /*<<< orphan*/ sscanf(char *, char *, float *);
char *strchr(char *, char);
void add_time(char *str, float offset, FILE *fp) {
  float time = 0.0f;
  char *c = strchr(str, ' ');
  if (c == 0)
    return;
  sscanf(str, "%f", &time);
  fprintf(fp, "%.3f%s", time + offset, c);
}


x86 assembly (clang, -O0):
<add_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116f <add_time+0x3f>
jmp    11a1 <add_time+0x71>
mov    -0x8(%rbp),%rdi
lea    0xe86(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
mov    -0x28(%rbp),%rdx
lea    0xe67(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_time>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
movss  %xmm0,0xc(%rsp)
mov    %rdi,%rbx
movl   $0x0,0x8(%rsp)
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1191 <add_time+0x61>
mov    %rax,%r15
lea    0xe9a(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
movss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
lea    0xe7d(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [7 x i8] c"%.3f%s\00"
define void @add_time(i8* %0, float %1, i32* %2) {
%4 = alloca i8*
%5 = alloca float
%6 = alloca i32*
%7 = alloca float
%8 = alloca i8*
store i8* %0, i8** %4
store float %1, float* %5
store i32* %2, i32** %6
store float 0.000000e+00, float* %7
%9 = load i8*, i8** %4
%10 = call i8* @strchr(i8* %9, i8 signext 32)
store i8* %10, i8** %8
%11 = load i8*, i8** %8
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %3
br label %23
14: ; preds = %3
%15 = load i8*, i8** %4
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %7)
%17 = load i32*, i32** %6
%18 = load float, float* %7
%19 = load float, float* %5
%20 = fadd float %18, %19
%21 = load i8*, i8** %8
%22 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float %20, i8* %21)
br label %23
23: ; preds = %14, %13
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [7 x i8] c"%.3f%s\00"
define void @add_time(i8* %0, float %1, i32* nocapture %2) {
%4 = alloca float
%5 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 32)
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %4)
%10 = load float, float* %4
%11 = fadd float %10, %1
%12 = call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float %11, i8* %6)
br label %13
13: ; preds = %3, %8
ret void
}