main(int ac, char **av) {
  double ran;
  long seed = 0;
  while (scanf("%d", &seed) == 1) {
    printf("%20d %20d : ", seed, ((seed)*1103515245 + 12345));
    seed = ((seed)*1103515245 + 12345) & 0x7fffffff;
    ran = ((double)(seed) / 1073741824.0 - 1.0);
    printf("%20d %14.6e\n", seed, ran);
  }
}


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)
movq   $0x0,-0x20(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11d1 <main+0xb1>
mov    -0x20(%rbp),%rsi
imul   $0x41c64e6d,-0x20(%rbp),%rdx
41
add    $0x3039,%rdx
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
imul   $0x41c64e6d,-0x20(%rbp),%rax
41
add    $0x3039,%rax
and    $0x7fffffff,%rax
mov    %rax,-0x20(%rbp)
cvtsi2sdq -0x20(%rbp),%xmm0
movsd  0xe68(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe54(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x20(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    113e <main+0x1e>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
lea    0xed9(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11d6 <main+0xb6>
lea    0xec2(%rip),%r14
lea    0xec8(%rip),%r15
lea    0xeb1(%rip),%r12
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp),%rsi
imul   $0x41c64e6d,%rsi,%rdx
add    $0x3039,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
imul   $0x41c64e6d,(%rsp),%esi
add    $0x3039,%esi
and    $0x7fffffff,%esi
mov    %rsi,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
mulsd  0xe4e(%rip),%xmm0
addsd  0xe4e(%rip),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"%20d %20d : \00"
@.str.2 = [13 x i8] c"%20d %14.6e\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %7
br label %8
8: ; preds = %11, %2
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64* %7)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = load i64, i64* %7
%13 = load i64, i64* %7
%14 = mul nsw i64 %13, 1103515245
%15 = add nsw i64 %14, 12345
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %12, i64 %15)
%17 = load i64, i64* %7
%18 = mul nsw i64 %17, 1103515245
%19 = add nsw i64 %18, 12345
%20 = and i64 %19, 2147483647
store i64 %20, i64* %7
%21 = load i64, i64* %7
%22 = sitofp i64 %21 to double
%23 = fdiv double %22, 0x41D0000000000000
%24 = fsub double %23, 1.000000e+00
store double %24, double* %6
%25 = load i64, i64* %7
%26 = load double, double* %6
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 %25, double %26)
br label %8
28: ; preds = %8
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"%20d %20d : \00"
@.str.2 = [13 x i8] c"%20d %14.6e\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64* %3)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %22
7: ; preds = %2, %7
%8 = load i64, i64* %3
%9 = mul nsw i64 %8, 1103515245
%10 = add nsw i64 %9, 12345
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %8, i64 %10)
%12 = load i64, i64* %3
%13 = mul nsw i64 %12, 1103515245
%14 = add nsw i64 %13, 12345
%15 = and i64 %14, 2147483647
store i64 %15, i64* %3
%16 = sitofp i64 %15 to double
%17 = fmul double %16, 0x3E10000000000000
%18 = fadd double %17, -1.000000e+00
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 %15, double %18)
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64* %3)
%21 = icmp eq i32 %20, 1
br i1 %21, label %7, label %22
22: ; preds = %7, %2
ret i32 0
}