#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*/ line;
typedef int int32_t;

/* Variables and functions */
double DBL_MAX;
double DBL_MIN;
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, double, double);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
double strtod(char *, char **);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void myMapLines(void) {
  char line[1024], *pos, *end;
  int32_t key;
  double val;
  double min_val;
  double max_val;
  while (fgets(line, sizeof(line), stdin)) {
    min_val = DBL_MAX;
    max_val = DBL_MIN;
    pos = line;
    for (pos = line;; pos = end) {
      val = strtod(pos, &end);
      if (pos == end)
        break;
      min_val = (val < min_val) ? val : min_val;
      max_val = (val > max_val) ? val : max_val;
    }
    srand(time(NULL));
    key = rand() % 255;
    printf("%d\t%f\t%f", key, min_val, max_val);
  }
}


x86 assembly (clang, -O0):
<myMapLines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
lea    -0x400(%rbp),%rdi
mov    0x2e6f(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     12fe <myMapLines+0x19e>
mov    0x2e42(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x428(%rbp)
ff
mov    0x2e27(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x430(%rbp)
ff
lea    -0x400(%rbp),%rax
mov    %rax,-0x408(%rbp)
lea    -0x400(%rbp),%rax
mov    %rax,-0x408(%rbp)
mov    -0x408(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x420(%rbp)
ff
mov    -0x408(%rbp),%rax
cmp    -0x410(%rbp),%rax
jne    1205 <myMapLines+0xa5>
jmp    12b2 <myMapLines+0x152>
movsd  -0x420(%rbp),%xmm1
ff
movsd  -0x428(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1234 <myMapLines+0xd4>
movsd  -0x420(%rbp),%xmm0
ff
movsd  %xmm0,-0x438(%rbp)
ff
jmp    1244 <myMapLines+0xe4>
movsd  -0x428(%rbp),%xmm0
ff
movsd  %xmm0,-0x438(%rbp)
ff
movsd  -0x438(%rbp),%xmm0
ff
movsd  %xmm0,-0x428(%rbp)
ff
movsd  -0x420(%rbp),%xmm0
ff
ucomisd -0x430(%rbp),%xmm0
ff
jbe    127f <myMapLines+0x11f>
movsd  -0x420(%rbp),%xmm0
ff
movsd  %xmm0,-0x440(%rbp)
ff
jmp    128f <myMapLines+0x12f>
movsd  -0x430(%rbp),%xmm0
ff
movsd  %xmm0,-0x440(%rbp)
ff
movsd  -0x440(%rbp),%xmm0
ff
movsd  %xmm0,-0x430(%rbp)
ff
mov    -0x410(%rbp),%rax
mov    %rax,-0x408(%rbp)
jmp    11d1 <myMapLines+0x71>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0xff,%ecx
cltd
idiv   %ecx
mov    %edx,-0x414(%rbp)
mov    -0x414(%rbp),%esi
movsd  -0x428(%rbp),%xmm0
ff
movsd  -0x430(%rbp),%xmm1
ff
lea    0xd0c(%rip),%rdi
call   1040 <printf@plt>
jmp    116b <myMapLines+0xb>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myMapLines>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    0x2e70(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     12b1 <myMapLines+0x151>
mov    0x2e3c(%rip),%rbp
mov    0x2e2d(%rip),%r13
lea    0x18(%rsp),%r12
lea    0xe51(%rip),%r15
jmp    122a <myMapLines+0xca>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0xffffffff80808081,%rax,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0x7,%esi
add    %ecx,%esi
mov    %esi,%ecx
shl    $0x8,%ecx
sub    %ecx,%esi
add    %eax,%esi
mov    %r15,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <printf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x400,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     12b1 <myMapLines+0x151>
movsd  0x0(%rbp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x0(%r13),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <strtod@plt>
mov    0x18(%rsp),%rbx
cmp    %rbx,%r14
je     11c0 <myMapLines+0x60>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
cs nopw 0x0(%rax,%rax,1)
movapd %xmm0,%xmm3
minsd  %xmm2,%xmm3
movsd  %xmm3,0x10(%rsp)
maxsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strtod@plt>
mov    0x18(%rsp),%rax
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
cmp    %rax,%rbx
mov    %rax,%rbx
jne    1270 <myMapLines+0x110>
jmp    11c0 <myMapLines+0x60>
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@DBL_MAX = global double 0.000000e+00
@DBL_MIN = global double 0.000000e+00
@.str = [9 x i8] c"%d\09%f\09%f\00"
define void @myMapLines() {
%1 = alloca [1024 x i8]
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
br label %8
8: ; preds = %46, %0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i64 @fgets(i8* %9, i32 1024, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %55
13: ; preds = %8
%14 = load double, double* @DBL_MAX
store double %14, double* %6
%15 = load double, double* @DBL_MIN
store double %15, double* %7
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
store i8* %16, i8** %2
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
store i8* %17, i8** %2
br label %18
18: ; preds = %44, %13
%19 = load i8*, i8** %2
%20 = call double @strtod(i8* %19, i8** %3)
store double %20, double* %5
%21 = load i8*, i8** %2
%22 = load i8*, i8** %3
%23 = icmp eq i8* %21, %22
br i1 %23, label %24, label %25
24: ; preds = %18
br label %46
25: ; preds = %18
%26 = load double, double* %5
%27 = load double, double* %6
%28 = fcmp olt double %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load double, double* %5
br label %33
31: ; preds = %25
%32 = load double, double* %6
br label %33
33: ; preds = %31, %29
%34 = phi double [ %30, %29 ], [ %32, %31 ]
store double %34, double* %6
%35 = load double, double* %5
%36 = load double, double* %7
%37 = fcmp ogt double %35, %36
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = load double, double* %5
br label %42
40: ; preds = %33
%41 = load double, double* %7
br label %42
42: ; preds = %40, %38
%43 = phi double [ %39, %38 ], [ %41, %40 ]
store double %43, double* %7
br label %44
44: ; preds = %42
%45 = load i8*, i8** %3
store i8* %45, i8** %2
br label %18
46: ; preds = %24
%47 = call i32 @time(i32* null)
%48 = call i32 @srand(i32 %47)
%49 = call i32 (...) @rand()
%50 = srem i32 %49, 255
store i32 %50, i32* %4
%51 = load i32, i32* %4
%52 = load double, double* %6
%53 = load double, double* %7
%54 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %51, double %52, double %53)
br label %8
55: ; preds = %8
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@DBL_MAX = global double 0.000000e+00
@DBL_MIN = global double 0.000000e+00
@.str = [9 x i8] c"%d\09%f\09%f\00"
define void @myMapLines() {
%1 = alloca [1024 x i8]
%2 = alloca i8*
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = bitcast i8** %2 to i8*
%5 = load i32, i32* @stdin
%6 = call i64 @fgets(i8* %3, i32 1024, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %37, label %8
8: ; preds = %0, %26
%9 = load double, double* @DBL_MAX
%10 = load double, double* @DBL_MIN
%11 = call double @strtod(i8* %3, i8** %2)
%12 = load i8*, i8** %2
%13 = icmp eq i8* %3, %12
br i1 %13, label %26, label %14
14: ; preds = %8, %14
%15 = phi i8* [ %24, %14 ], [ %12, %8 ]
%16 = phi double [ %23, %14 ], [ %11, %8 ]
%17 = phi double [ %22, %14 ], [ %10, %8 ]
%18 = phi double [ %20, %14 ], [ %9, %8 ]
%19 = fcmp olt double %16, %18
%20 = select i1 %19, double %16, double %18
%21 = fcmp ogt double %16, %17
%22 = select i1 %21, double %16, double %17
%23 = call double @strtod(i8* %15, i8** %2)
%24 = load i8*, i8** %2
%25 = icmp eq i8* %15, %24
br i1 %25, label %26, label %14
26: ; preds = %14, %8
%27 = phi double [ %9, %8 ], [ %20, %14 ]
%28 = phi double [ %10, %8 ], [ %22, %14 ]
%29 = call i32 @time(i32* null)
%30 = call i32 @srand(i32 %29)
%31 = call i32 (...) @rand()
%32 = srem i32 %31, 255
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %32, double %27, double %28)
%34 = load i32, i32* @stdin
%35 = call i64 @fgets(i8* %3, i32 1024, i32 %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %8
37: ; preds = %26, %0
ret void
}