#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(int);
int /*<<< orphan*/ read_field();
int /*<<< orphan*/ sscanf(char *, char *, double *);
int /*<<< orphan*/ write_field();
void main(int argc, char *argv[]) {
  double z;
  void fresnel();
  void error_print();
  if (argc != 2) {
    error_print(argv[0]);
    exit(1);
  }
  sscanf(argv[1], "%le", &z);
  read_field();
  fresnel(z);
  write_field();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1191 <main+0x31>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1060 <error_print@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe60(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <sscanf@plt>
mov    $0x0,%al
call   1030 <read_field@plt>
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   1040 <fresnel@plt>
mov    $0x0,%al
call   1080 <write_field@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1195 <main+0x35>
mov    0x8(%rsi),%rdi
lea    0xe8f(%rip),%rsi
mov    %rsp,%rdx
call   1050 <sscanf@plt>
xor    %eax,%eax
call   1030 <read_field@plt>
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <fresnel@plt>
xor    %eax,%eax
call   1080 <write_field@plt>
pop    %rax
ret
mov    (%rsi),%rdi
xor    %eax,%eax
call   1060 <error_print@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%le\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca double
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %5)
%18 = call i32 (...) @read_field()
%19 = load double, double* %5
%20 = call i32 (...) @write_field()
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%le\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
tail call void (i8*, ...) bitcast (void (...)* @error_print to void (i8*, ...)*)(i8* %7)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%13 = call i32 (...) @read_field()
%14 = load double, double* %3
%15 = call i32 (...) @write_field()
ret void
}