#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 atan(int /*<<< orphan*/);
double atof(char *);
double cos(double);
int /*<<< orphan*/ exp(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
double sin(double);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "usage: %s eta \n", argv[0]);
    return 1;
  }
  double eta = atof(argv[1]);
  double val = 2.0 * atan(exp(-1.0e0 * eta));
  double cott = cos(val) / sin(val);
  fprintf(stdout, "cot(theta): %f \n", cott);
  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)
je     11aa <main+0x4a>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1236 <main+0xd6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe44(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1070 <exp@plt>
mov    %eax,%edi
call   1060 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xe20(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1080 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
movsd  -0x28(%rbp),%xmm0
lea    0xdf8(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    11d2 <main+0x72>
mov    0x8(%rsi),%rdi
call   1030 <atof@plt>
xorpd  0xe86(%rip),%xmm0
call   1070 <exp@plt>
mov    %eax,%edi
call   1060 <atan@plt>
addsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
call   1080 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe2b(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"usage: %s eta \0A\00"
@stdout = global i32 0
@.str.1 = [17 x i8] c"cot(theta): %f \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %35
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call double @atof(i8* %20)
store double %21, double* %6
%22 = load double, double* %6
%23 = fmul double -1.000000e+00, %22
%24 = call i32 @exp(double %23)
%25 = call double @atan(i32 %24)
%26 = fmul double 2.000000e+00, %25
store double %26, double* %7
%27 = load double, double* %7
%28 = call double @cos(double %27)
%29 = load double, double* %7
%30 = call double @sin(double %29)
%31 = fdiv double %28, %30
store double %31, double* %8
%32 = load i32, i32* @stdout
%33 = load double, double* %8
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %33)
store i32 0, i32* %3
br label %35
35: ; preds = %17, %11
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"usage: %s eta \0A\00"
@stdout = global i32 0
@.str.1 = [17 x i8] c"cot(theta): %f \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %21
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call double @atof(i8* %10)
%12 = fneg double %11
%13 = tail call i32 @exp(double %12)
%14 = tail call double @atan(i32 %13)
%15 = fmul double %14, 2.000000e+00
%16 = tail call double @cos(double %15)
%17 = tail call double @sin(double %15)
%18 = fdiv double %16, %17
%19 = load i32, i32* @stdout
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %18)
br label %21
21: ; preds = %8, %4
%22 = phi i32 [ 1, %4 ], [ 0, %8 ]
ret i32 %22
}