#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 */
double atof(char *);
double fast_sin(double);
int /*<<< orphan*/ printf(char *, char *, double);
int /*<<< orphan*/ puts(char *);
double sin(double);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    puts("Usage: ./test <number>");
    return 1;
  }
  double x = atof(argv[1]);
  printf("sin(%s)\t= %f\n", argv[1], sin(x));
  printf("fast_sin(%s)\t= %f\n", argv[1], fast_sin(x));
  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    1188 <main+0x38>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ed <main+0x9d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <sin@plt>
mov    -0x28(%rbp),%rsi
lea    0xe61(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1070 <fast_sin@plt>
mov    -0x20(%rbp),%rsi
lea    0xe36(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     116c <main+0x1c>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    11b3 <main+0x63>
mov    %rsi,%rbx
mov    0x8(%rsi),%r14
mov    %r14,%rdi
call   1040 <atof@plt>
movsd  %xmm0,(%rsp)
call   1060 <sin@plt>
lea    0xe90(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
mov    0x8(%rbx),%rbx
movsd  (%rsp),%xmm0
call   1070 <fast_sin@plt>
lea    0xe6e(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: ./test <number>\00"
@.str.1 = [14 x i8] c"sin(%s)\09= %f\0A\00"
@.str.2 = [19 x i8] c"fast_sin(%s)\09= %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %28
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call double @atof(i8* %14)
store double %15, double* %6
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load double, double* %6
%20 = call double @sin(double %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %18, double %20)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load double, double* %6
%26 = call double @fast_sin(double %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %24, double %26)
store i32 0, i32* %3
br label %28
28: ; preds = %11, %9
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: ./test <number>\00"
@.str.1 = [14 x i8] c"sin(%s)\09= %f\0A\00"
@.str.2 = [19 x i8] c"fast_sin(%s)\09= %f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %15
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call double @atof(i8* %8)
%10 = tail call double @sin(double %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %8, double %10)
%12 = load i8*, i8** %7
%13 = tail call double @fast_sin(double %9)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %12, double %13)
br label %15
15: ; preds = %6, %4
%16 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %16
}