#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int gut_parse_double(char *, double *);
int /*<<< orphan*/ printf(char *, double, unsigned long long);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <number>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  double val;
  int err;
  err = gut_parse_double(argv[1], &val);
  if (err) {
    fprintf(stderr, "Error: conversion failed (%d)\n", err);
    if (err == -3) {
      fprintf(stderr, "(value returned: %.16g [%llx])\n", val,
              *(unsigned long long *)&val);
    }
    exit(EXIT_FAILURE);
  }
  printf("gut_parse_double() returned %.16g [%llx]\n", val,
         *(unsigned long long *)&val);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118c <main+0x4c>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <gut_parse_double@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11fc <main+0xbc>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
cmpl   $0xfffffffd,-0x1c(%rbp)
jne    11ee <main+0xae>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
mov    -0x18(%rbp),%rdx
lea    0xe4c(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
movsd  -0x18(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     1165 <main+0x25>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xea4(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11d5 <main+0x95>
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
call   1040 <gut_parse_double@plt>
test   %eax,%eax
jne    1199 <main+0x59>
movq   (%rsp),%xmm0
movq   %xmm0,%rsi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    %eax,%ebx
mov    0x2e3e(%rip),%r14
mov    (%r14),%edi
lea    0xe68(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
cmp    $0xfffffffd,%ebx
jne    11d5 <main+0x95>
mov    (%r14),%edi
movq   (%rsp),%xmm0
movq   %xmm0,%rdx
lea    0xe65(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <number>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"Error: conversion failed (%d)\0A\00"
@.str.2 = [32 x i8] c"(value returned: %.16g [%llx])\0A\00"
@.str.3 = [42 x i8] c"gut_parse_double() returned %.16g [%llx]\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %18
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @gut_parse_double(i8* %21, double* %6)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %40
25: ; preds = %18
%26 = load i32, i32* @stderr
%27 = load i32, i32* %7
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %7
%30 = icmp eq i32 %29, -3
br i1 %30, label %31, label %37
31: ; preds = %25
%32 = load i32, i32* @stderr
%33 = load double, double* %6
%34 = bitcast double* %6 to i64*
%35 = load i64, i64* %34
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %33, i64 %35)
br label %37
37: ; preds = %31, %25
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %18
%41 = load double, double* %6
%42 = bitcast double* %6 to i64*
%43 = load i64, i64* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), double %41, i64 %43)
%45 = load i32, i32* @EXIT_SUCCESS
%46 = call i32 @exit(i32 %45)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <number>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"Error: conversion failed (%d)\0A\00"
@.str.2 = [32 x i8] c"(value returned: %.16g [%llx])\0A\00"
@.str.3 = [42 x i8] c"gut_parse_double() returned %.16g [%llx]\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = bitcast double* %3 to i8*
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @gut_parse_double(i8* %14, double* %3)
%16 = icmp eq i32 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%20 = icmp eq i32 %15, -3
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = load double, double* %3
%24 = bitcast double %23 to i64
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %23, i64 %24)
br label %26
26: ; preds = %21, %17
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %11
%30 = load double, double* %3
%31 = bitcast double %30 to i64
%32 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), double %30, i64 %31)
%33 = load i32, i32* @EXIT_SUCCESS
%34 = call i32 @exit(i32 %33)
unreachable
}