#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 atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int sides;
  if (argc == 2)
    sides = atoi(argv[1]);
  else {
    printf("\n\t Use: each_angle $NUMBER_OF_SIDES\n\n");
    return -1;
  }
  if (sides >= 3) {
    printf("In a figure with %d sides,\n", sides);
    printf("\n\tsum of all angles = %g°\n", (sides - 2) * 180.0);
    printf("\t    average angle = %g°\n\n", (sides - 2) * 180.0 / sides);
  } else
    printf("You need at least 3 sides to form a polygon.\n");
  return 0;
}


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)
jne    1155 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    116f <main+0x4f>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f5 <main+0xd5>
cmpl   $0x3,-0x14(%rbp)
jl     11e0 <main+0xc0>
mov    -0x14(%rbp),%esi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe64(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe40(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xe92(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11ee <main+0xce>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1199 <main+0x69>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
cmp    $0x2,%eax
jle    11ac <main+0x7c>
mov    %eax,%ebx
lea    0xeb9(%rip),%rdi
xor    %ebp,%ebp
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x2(%rbx),%eax
cvtsi2sd %eax,%xmm0
mulsd  0xe97(%rip),%xmm0
movsd  %xmm0,(%rsp)
lea    0xeaf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cvtsi2sd %ebx,%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
lea    0xeb0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11ba <main+0x8a>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebp
jmp    11ba <main+0x8a>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\0A\09 Use: each_angle $NUMBER_OF_SIDES\0A\0A\00"
@.str.1 = [28 x i8] c"In a figure with %d sides,\0A\00"
@.str.2 = [28 x i8] c"\0A\09sum of all angles = %g\C2\B0\0A\00"
@.str.3 = [28 x i8] c"\09 average angle = %g\C2\B0\0A\0A\00"
@.str.4 = [46 x i8] c"You need at least 3 sides to form a polygon.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
br label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %38
16: ; preds = %9
%17 = load i32, i32* %6
%18 = icmp sge i32 %17, 3
br i1 %18, label %19, label %35
19: ; preds = %16
%20 = load i32, i32* %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 2
%24 = sitofp i32 %23 to double
%25 = fmul double %24, 1.800000e+02
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %25)
%27 = load i32, i32* %6
%28 = sub nsw i32 %27, 2
%29 = sitofp i32 %28 to double
%30 = fmul double %29, 1.800000e+02
%31 = load i32, i32* %6
%32 = sitofp i32 %31 to double
%33 = fdiv double %30, %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %33)
br label %37
35: ; preds = %16
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35, %19
store i32 0, i32* %3
br label %38
38: ; preds = %37, %14
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"In a figure with %d sides,\0A\00"
@.str.2 = [28 x i8] c"\0A\09sum of all angles = %g\C2\B0\0A\00"
@.str.3 = [28 x i8] c"\09 average angle = %g\C2\B0\0A\0A\00"
@str = [37 x i8] c"\0A\09 Use: each_angle $NUMBER_OF_SIDES\0A\00"
@str.5 = [45 x i8] c"You need at least 3 sides to form a polygon.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp sgt i32 %7, 2
br i1 %8, label %11, label %20
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %22
11: ; preds = %4
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%13 = add nsw i32 %7, -2
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 1.800000e+02
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %15)
%17 = sitofp i32 %7 to double
%18 = fdiv double %15, %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %18)
br label %22
20: ; preds = %4
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.5, i64 0, i64 0))
br label %22
22: ; preds = %11, %20, %9
%23 = phi i32 [ -1, %9 ], [ 0, %20 ], [ 0, %11 ]
ret i32 %23
}