#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ negative;
  int /*<<< orphan*/ exponent;
  int /*<<< orphan*/ mantissa;
};
union ieee754_float {
  double f;
  TYPE_1__ ieee;
};

/* Variables and functions */
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
double atof(char *);
scalar_t__ errno;
int /*<<< orphan*/ fprintf(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
char *strerror(scalar_t__);
int main(int argc, char *argv[]) {
  int i;
  if (argc < 2) {
    fprintf("usage: %s STRING ...\n", argv[0]);
    return 1;
  }
  for (i = 1; i < argc; i++) {
    union ieee754_float ufloat;
    __set_errno(0);
    ufloat.f = atof(argv[i]);
    if (errno != 0)
      printf("%s: conversion error: %s\n", argv[i], strerror(errno));
    printf("%g: mantissa: %lu, exponent: %lu, negative: %lu\n", ufloat.f,
           ufloat.ieee.mantissa, ufloat.ieee.exponent, ufloat.ieee.negative);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe82(%rip),%rdi
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1235 <main+0xe5>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122e <main+0xde>
xor    %edi,%edi
call   1030 <__set_errno@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
mov    0x2e1a(%rip),%rax
cmpq   $0x0,(%rax)
je     1204 <main+0xb4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    0x2df9(%rip),%rax
mov    (%rax),%rdi
call   1070 <strerror@plt>
mov    -0x30(%rbp),%rsi
mov    %rax,%rdx
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x28(%rbp),%xmm0
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xe17(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1196 <main+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
cmp    $0x2,%edi
jge    117d <main+0x2d>
mov    (%r12),%rsi
lea    0xe92(%rip),%rdi
call   1060 <fprintf@plt>
mov    $0x1,%eax
jmp    1201 <main+0xb1>
mov    %edi,%r13d
mov    $0x1,%ebp
mov    0x2e54(%rip),%r15
lea    0xe9d(%rip),%r14
jmp    11bf <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
nop
movq   %xmm0,%rcx
mov    %rcx,%rdx
shr    $0x20,%rdx
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     11ff <main+0xaf>
xor    %edi,%edi
call   1030 <__set_errno@plt>
mov    (%r12,%rbp,8),%rbx
mov    %rbx,%rdi
call   1040 <atof@plt>
mov    (%r15),%rdi
test   %rdi,%rdi
je     11a0 <main+0x50>
movsd  %xmm0,(%rsp)
call   1070 <strerror@plt>
lea    0xe2b(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
movq   (%rsp),%xmm0
jmp    11a0 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%union.ieee754_float = type { double, [8 x i8] }
%struct.TYPE_2__ = type { i32, i32, i32 }
@.str = [22 x i8] c"usage: %s STRING ...\0A\00"
@errno = global i64 0
@.str.1 = [26 x i8] c"%s: conversion error: %s\0A\00"
@.str.2 = [49 x i8] c"%g: mantissa: %lu, exponent: %lu, negative: %lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %union.ieee754_float
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 %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 1, i32* %3
br label %57
15: ; preds = %2
store i32 1, i32* %6
br label %16
16: ; preds = %53, %15
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %56
20: ; preds = %16
%21 = call i32 @__set_errno(i32 0)
%22 = load i8**, i8*** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call double @atof(i8* %26)
%28 = bitcast %union.ieee754_float* %7 to double*
store double %27, double* %28
%29 = load i64, i64* @errno
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %40
31: ; preds = %20
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = load i64, i64* @errno
%38 = call i8* @strerror(i64 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %36, i8* %38)
br label %40
40: ; preds = %31, %20
%41 = bitcast %union.ieee754_float* %7 to double*
%42 = load double, double* %41
%43 = bitcast %union.ieee754_float* %7 to %struct.TYPE_2__*
%44 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %43, i32 0, i32 2
%45 = load i32, i32* %44
%46 = bitcast %union.ieee754_float* %7 to %struct.TYPE_2__*
%47 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %46, i32 0, i32 1
%48 = load i32, i32* %47
%49 = bitcast %union.ieee754_float* %7 to %struct.TYPE_2__*
%50 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %49, i32 0, i32 0
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), double %42, i32 %45, i32 %48, i32 %51)
br label %53
53: ; preds = %40
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %16
56: ; preds = %16
store i32 0, i32* %3
br label %57
57: ; preds = %56, %10
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@.str = [22 x i8] c"usage: %s STRING ...\0A\00"
@errno = global i64 0
@.str.1 = [26 x i8] c"%s: conversion error: %s\0A\00"
@.str.2 = [49 x i8] c"%g: mantissa: %lu, exponent: %lu, negative: %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %28
9: ; preds = %4, %20
%10 = phi i64 [ 1, %4 ], [ %26, %20 ]
%11 = tail call i32 @__set_errno(i32 0)
%12 = getelementptr inbounds i8*, i8** %1, i64 %10
%13 = load i8*, i8** %12
%14 = tail call double @atof(i8* %13)
%15 = load i64, i64* @errno
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %9
%18 = tail call i8* @strerror(i64 %15)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %18)
br label %20
20: ; preds = %17, %9
%21 = bitcast double %14 to i64
%22 = lshr i64 %21, 32
%23 = trunc i64 %22 to i32
%24 = trunc i64 %21 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), double %14, i32 undef, i32 %23, i32 %24)
%26 = add nuw nsw i64 %10, 1
%27 = icmp eq i64 %26, %5
br i1 %27, label %28, label %9
28: ; preds = %20, %6
%29 = phi i32 [ 1, %6 ], [ 0, %20 ]
ret i32 %29
}