#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*/ EIO;
int EXIT_SUCCESS;
int /*<<< orphan*/ approx_sin(double);
int /*<<< orphan*/ atof(char *);
double deg_to_rad(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Invalid argument count\n");
    exit(EIO);
  }
  double angle = deg_to_rad(atof(argv[1]));
  printf("%lf\n", approx_sin(angle));
  return EXIT_SUCCESS;
}


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)
cmpl   $0x2,-0x8(%rbp)
je     11a3 <main+0x43>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
mov    %eax,%edi
call   1030 <deg_to_rad@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1080 <approx_sin@plt>
mov    %eax,%esi
lea    0xe49(%rip),%rdi
call   1050 <printf@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1194 <main+0x34>
mov    0x8(%rsi),%rdi
call   1040 <atof@plt>
mov    %eax,%edi
call   1030 <deg_to_rad@plt>
call   1080 <approx_sin@plt>
lea    0xe96(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Invalid argument count\0A\00"
@EIO = global i32 0
@.str.1 = [5 x i8] c"%lf\0A\00"
@EXIT_SUCCESS = global i32 0
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 ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EIO
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atof(i8* %17)
%19 = call double @deg_to_rad(i32 %18)
store double %19, double* %6
%20 = load double, double* %6
%21 = call i32 @approx_sin(double %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Invalid argument count\0A\00"
@EIO = global i32 0
@.str.1 = [5 x i8] c"%lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EIO
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atof(i8* %11)
%13 = tail call double @deg_to_rad(i32 %12)
%14 = tail call i32 @approx_sin(double %13)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}