#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 */
double NAN;
int sscanf(char *, char *, char *, double *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
double get_xml_tagged_number(char *tag, char *line) {
  char buf[0x100], buf2[0x100];
  double x;
  int r = sscanf(line, " <%[^>]>%lf</%[^>]>", buf, &x, buf2);
  strcpy(tag, buf);
  if (r == 3) {
    return x;
  } else
    return NAN;
}


x86 assembly (clang, -O0):
<get_xml_tagged_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%r8
lea    0xeb4(%rip),%rsi
lea    -0x228(%rbp),%rcx
call   1040 <sscanf@plt>
mov    %eax,-0x22c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1030 <strcpy@plt>
cmpl   $0x3,-0x22c(%rbp)
jne    118d <get_xml_tagged_number+0x6d>
movsd  -0x228(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
jmp    119d <get_xml_tagged_number+0x7d>
mov    0x2e64(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_xml_tagged_number>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%rax
mov    %rdi,%r14
lea    0xec6(%rip),%rsi
lea    0x110(%rsp),%r15
lea    0x8(%rsp),%rbx
lea    0x10(%rsp),%r8
mov    %rax,%rdi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1040 <sscanf@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
cmp    $0x3,%ebp
je     1173 <get_xml_tagged_number+0x53>
mov    0x2e85(%rip),%rbx
movsd  (%rbx),%xmm0
add    $0x218,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c" <%[^>]>%lf</%[^>]>\00"
@NAN = global double 0.000000e+00
define double @get_xml_tagged_number(i8* %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca double
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%10 = load i8*, i8** %5
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%13 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %11, double* %8, i8* %12)
store i32 %13, i32* %9
%14 = load i8*, i8** %4
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i32, i32* %9
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = load double, double* %8
store double %20, double* %3
br label %23
21: ; preds = %2
%22 = load double, double* @NAN
store double %22, double* %3
br label %23
23: ; preds = %21, %19
%24 = load double, double* %3
ret double %24
}

LLVM IR (-O2):
@.str = [20 x i8] c" <%[^>]>%lf</%[^>]>\00"
@NAN = global double 0.000000e+00
define double @get_xml_tagged_number(i8* %0, i8* nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca double
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = bitcast double* %5 to i8*
%9 = call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6, double* %5, i8* %7)
%10 = call i32 @strcpy(i8* %0, i8* %6)
%11 = icmp eq i32 %9, 3
%12 = load double, double* %5
%13 = load double, double* @NAN
%14 = select i1 %11, double %12, double %13
ret double %14
}