#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 */
long LONG_MAX;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, long, double);
int /*<<< orphan*/ stderr;
long strtol(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  long total;
  register long n;
  if (argc < 2) {
    fprintf(stderr, "%s [depth]\n", argv[0]);
    return 1;
  }
  n = strtol(argv[1], NULL, 0);
  if (n < 3 || n >= LONG_MAX) {
    fprintf(stderr, "Cannot have %li sides in a polygon.\n", n);
    return 1;
  }
  total = 180 * n - 360;
  printf(
      "Interior angles sum up to %li degrees.  (Each angle is %g degrees.)\n",
      total, (double)total / 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)
jge    117a <main+0x4a>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1210 <main+0xe0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x3,-0x20(%rbp)
jl     11b0 <main+0x80>
mov    -0x20(%rbp),%rax
mov    0x2e31(%rip),%rcx
cmp    (%rcx),%rax
jl     11d7 <main+0xa7>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1210 <main+0xe0>
imul   $0xb4,-0x20(%rbp),%rax
sub    $0x168,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
cvtsi2sdq -0x18(%rbp),%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     114b <main+0x1b>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xeb7(%rip),%rsi
jmp    11a9 <main+0x79>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
cmp    $0x3,%rax
jl     1196 <main+0x66>
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%rax
jge    1196 <main+0x66>
imul   $0xb4,%rax,%rsi
add    $0xfffffffffffffe98,%rsi
cvtsi2sd %rsi,%xmm0
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e43(%rip),%rcx
mov    (%rcx),%edi
lea    0xe66(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"%s [depth]\0A\00"
@LONG_MAX = global i64 0
@.str.1 = [37 x i8] c"Cannot have %li sides in a polygon.\0A\00"
@.str.2 = [69 x i8] c"Interior angles sum up to %li degrees. (Each angle is %g degrees.)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %42
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strtol(i8* %19, i32* null, i32 0)
store i64 %20, i64* %7
%21 = load i64, i64* %7
%22 = icmp slt i64 %21, 3
br i1 %22, label %27, label %23
23: ; preds = %16
%24 = load i64, i64* %7
%25 = load i64, i64* @LONG_MAX
%26 = icmp sge i64 %24, %25
br i1 %26, label %27, label %31
27: ; preds = %23, %16
%28 = load i32, i32* @stderr
%29 = load i64, i64* %7
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i64 %29)
store i32 1, i32* %3
br label %42
31: ; preds = %23
%32 = load i64, i64* %7
%33 = mul nsw i64 180, %32
%34 = sub nsw i64 %33, 360
store i64 %34, i64* %6
%35 = load i64, i64* %6
%36 = load i64, i64* %6
%37 = sitofp i64 %36 to double
%38 = load i64, i64* %7
%39 = sitofp i64 %38 to double
%40 = fdiv double %37, %39
%41 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), i64 %35, double %40)
store i32 0, i32* %3
br label %42
42: ; preds = %31, %27, %10
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"%s [depth]\0A\00"
@LONG_MAX = global i64 0
@.str.1 = [37 x i8] c"Cannot have %li sides in a polygon.\0A\00"
@.str.2 = [69 x i8] c"Interior angles sum up to %li degrees. (Each angle is %g degrees.)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
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 ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %26
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strtol(i8* nocapture %10, i32* null, i32 0)
%12 = icmp sgt i64 %11, 2
%13 = load i64, i64* @LONG_MAX
%14 = icmp slt i64 %11, %13
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %19, label %16
16: ; preds = %8
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i64 %11)
br label %26
19: ; preds = %8
%20 = mul nsw i64 %11, 180
%21 = add nsw i64 %20, -360
%22 = sitofp i64 %21 to double
%23 = sitofp i64 %11 to double
%24 = fdiv double %22, %23
%25 = tail call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), i64 %21, double %24)
br label %26
26: ; preds = %19, %16, %4
%27 = phi i32 [ 1, %4 ], [ 1, %16 ], [ 0, %19 ]
ret i32 %27
}