#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 _plnorm(double);
int abs(int);
int /*<<< orphan*/ plot(double, double, int);
int /*<<< orphan*/ printf(char *, int);
int mark(int mrk, double ax[], double ay[], int n, double f, int m) {
  int i;
  if (mrk < 0 || mrk > 15)
    return (1);
  m = (n < 0) ? m : 1;
  if ((n = abs(n)) < 1 || m < 0)
    return (1);
  printf("S%d\n", _plnorm(f * 1.75));
  printf("R%d\n", 0);
  for (i = 0; i < n; i += m) {
    plot(ax[i], ay[i], 3);
    printf("N%d\n", mrk);
  }
  return (0);
}


x86 assembly (clang, -O0):
<mark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1173 <mark+0x33>
cmpl   $0xf,-0x8(%rbp)
jle    117f <mark+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    125a <mark+0x11a>
cmpl   $0x0,-0x1c(%rbp)
jge    1194 <mark+0x54>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    11a1 <mark+0x61>
mov    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a1 <mark+0x61>
mov    -0x34(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x1,%eax
jl     11c5 <mark+0x85>
cmpl   $0x0,-0x2c(%rbp)
jge    11d1 <mark+0x91>
movl   $0x1,-0x4(%rbp)
jmp    125a <mark+0x11a>
movsd  0xe27(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1040 <_plnorm@plt>
mov    %eax,%esi
lea    0xe1c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe15(%rip),%rdi
xor    %esi,%esi
call   1050 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1253 <mark+0x113>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    $0x3,%edi
call   1060 <plot@plt>
mov    -0x8(%rbp),%esi
lea    0xdd2(%rip),%rdi
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1206 <mark+0xc6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mark>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%eax
cmp    $0xf,%edi
ja     11cf <mark+0x9f>
mov    %r8d,%r12d
mov    $0x1,%eax
test   %ecx,%ecx
cmovns %eax,%r12d
je     11cf <mark+0x9f>
test   %r12d,%r12d
js     11cf <mark+0x9f>
mov    %rdx,%r14
mov    %rsi,%r13
mov    %edi,%ebp
mov    %ecx,%ebx
neg    %ebx
cmovs  %ecx,%ebx
mulsd  0xe8b(%rip),%xmm0
call   1030 <_plnorm@plt>
lea    0xe87(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xe7e(%rip),%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    %r12d,%r15d
xor    %r12d,%r12d
nopl   0x0(%rax)
movsd  0x0(%r13,%r12,8),%xmm0
movsd  (%r14,%r12,8),%xmm1
mov    $0x3,%edi
call   1050 <plot@plt>
lea    0xe54(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
add    %r15,%r12
cmp    %rbx,%r12
jl     11a0 <mark+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"S%d\0A\00"
@.str.1 = [5 x i8] c"R%d\0A\00"
@.str.2 = [5 x i8] c"N%d\0A\00"
define i32 @mark(i32 %0, double* %1, double* %2, i32 %3, double %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %8
store double* %1, double** %9
store double* %2, double** %10
store i32 %3, i32* %11
store double %4, double* %12
store i32 %5, i32* %13
%15 = load i32, i32* %8
%16 = icmp slt i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %6
%18 = load i32, i32* %8
%19 = icmp sgt i32 %18, 15
br i1 %19, label %20, label %21
20: ; preds = %17, %6
store i32 1, i32* %7
br label %65
21: ; preds = %17
%22 = load i32, i32* %11
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i32, i32* %13
br label %27
26: ; preds = %21
br label %27
27: ; preds = %26, %24
%28 = phi i32 [ %25, %24 ], [ 1, %26 ]
store i32 %28, i32* %13
%29 = load i32, i32* %11
%30 = call i32 @abs(i32 %29)
store i32 %30, i32* %11
%31 = icmp slt i32 %30, 1
br i1 %31, label %35, label %32
32: ; preds = %27
%33 = load i32, i32* %13
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %32, %27
store i32 1, i32* %7
br label %65
36: ; preds = %32
%37 = load double, double* %12
%38 = fmul double %37, 1.750000e+00
%39 = call i32 @_plnorm(double %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %39)
%41 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
store i32 0, i32* %14
br label %42
42: ; preds = %60, %36
%43 = load i32, i32* %14
%44 = load i32, i32* %11
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %64
46: ; preds = %42
%47 = load double*, double** %9
%48 = load i32, i32* %14
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = load double*, double** %10
%53 = load i32, i32* %14
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = call i32 @plot(double %51, double %56, i32 3)
%58 = load i32, i32* %8
%59 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %46
%61 = load i32, i32* %13
%62 = load i32, i32* %14
%63 = add nsw i32 %62, %61
store i32 %63, i32* %14
br label %42
64: ; preds = %42
store i32 0, i32* %7
br label %65
65: ; preds = %64, %35, %20
%66 = load i32, i32* %7
ret i32 %66
}

LLVM IR (-O2):
@.str = [5 x i8] c"S%d\0A\00"
@.str.1 = [5 x i8] c"R%d\0A\00"
@.str.2 = [5 x i8] c"N%d\0A\00"
define i32 @mark(i32 %0, double* nocapture %1, double* nocapture %2, i32 %3, double %4, i32 %5) {
%7 = icmp ugt i32 %0, 15
br i1 %7, label %32, label %8
8: ; preds = %6
%9 = icmp slt i32 %3, 0
%10 = select i1 %9, i32 %5, i32 1
%11 = icmp eq i32 %3, 0
%12 = icmp slt i32 %10, 0
%13 = or i1 %11, %12
br i1 %13, label %32, label %14
14: ; preds = %8
%15 = tail call i32 @llvm.abs.i32(i32 %3, i1 true)
%16 = fmul double %4, 1.750000e+00
%17 = tail call i32 @_plnorm(double %16)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
%20 = zext i32 %10 to i64
%21 = zext i32 %15 to i64
br label %22
22: ; preds = %14, %22
%23 = phi i64 [ 0, %14 ], [ %30, %22 ]
%24 = getelementptr inbounds double, double* %1, i64 %23
%25 = load double, double* %24
%26 = getelementptr inbounds double, double* %2, i64 %23
%27 = load double, double* %26
%28 = tail call i32 @plot(double %25, double %27, i32 3)
%29 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%30 = add i64 %23, %20
%31 = icmp slt i64 %30, %21
br i1 %31, label %22, label %32
32: ; preds = %22, %8, %6
%33 = phi i32 [ 1, %6 ], [ 1, %8 ], [ 0, %22 ]
ret i32 %33
}