#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;

/* 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*/ stdin;
double strtod(char *, char **);
void myMapLines(void) {
  char line[1024], *pos, *end;
  int 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;
    }
    key = (rand() % 255) + 1;
    printf("%d\t%lf\t%lf\n", key, min_val, max_val);
  }
}


x86 assembly (clang, -O0):
<myMapLines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
lea    -0x400(%rbp),%rdi
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     12d1 <myMapLines+0x191>
mov    0x2e62(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x428(%rbp)
ff
mov    0x2e47(%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    11e5 <myMapLines+0xa5>
jmp    1292 <myMapLines+0x152>
movsd  -0x420(%rbp),%xmm1
ff
movsd  -0x428(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1214 <myMapLines+0xd4>
movsd  -0x420(%rbp),%xmm0
ff
movsd  %xmm0,-0x438(%rbp)
ff
jmp    1224 <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    125f <myMapLines+0x11f>
movsd  -0x420(%rbp),%xmm0
ff
movsd  %xmm0,-0x440(%rbp)
ff
jmp    126f <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    11b1 <myMapLines+0x71>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xff,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x414(%rbp)
mov    -0x414(%rbp),%esi
movsd  -0x428(%rbp),%xmm0
ff
movsd  -0x430(%rbp),%xmm1
ff
lea    0xd39(%rip),%rdi
call   1040 <printf@plt>
jmp    114b <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    0x2e90(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1281 <myMapLines+0x141>
mov    0x2e5c(%rip),%rbp
mov    0x2e4d(%rip),%r13
lea    0x18(%rsp),%r12
lea    0xe71(%rip),%r15
jmp    1200 <myMapLines+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0xffffffff80808081,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x7,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x8,%edx
sub    %edx,%ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
mov    %r15,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <printf@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1281 <myMapLines+0x141>
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     11a0 <myMapLines+0x60>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
nopl   0x0(%rax)
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    1240 <myMapLines+0x100>
jmp    11a0 <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 = [12 x i8] c"%d\09%lf\09%lf\0A\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 %54
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 (...) @rand()
%48 = srem i32 %47, 255
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
%50 = load i32, i32* %4
%51 = load double, double* %6
%52 = load double, double* %7
%53 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %50, double %51, double %52)
br label %8
54: ; 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 = [12 x i8] c"%d\09%lf\09%lf\0A\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 %36, 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 (...) @rand()
%30 = srem i32 %29, 255
%31 = add nsw i32 %30, 1
%32 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %31, double %27, double %28)
%33 = load i32, i32* @stdin
%34 = call i64 @fgets(i8* %3, i32 1024, i32 %33)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %8
36: ; preds = %26, %0
ret void
}