#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*/ _chlnmod(int);
int _cordx(double);
int _cordy(double);
int /*<<< orphan*/ printf(char *, int, int, ...);
int plota(int ip, double x, double y) {
  if (ip == 1)
    printf("M%d %d\n", _cordx(x), _cordy(y));
  else if (ip == 0 || ip == 2) {
    if (ip == 2)
      _chlnmod(1);
    printf("D%d %d\n%c", _cordx(x), _cordy(y), 0);
    if (ip == 2)
      _chlnmod(0);
  } else
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<plota>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    118e <plota+0x4e>
movsd  -0x10(%rbp),%xmm0
call   1040 <_cordx@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <_cordy@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <plota+0xc9>
cmpl   $0x0,-0x8(%rbp)
je     11a2 <plota+0x62>
cmpl   $0x2,-0x8(%rbp)
jne    11f8 <plota+0xb8>
cmpl   $0x2,-0x8(%rbp)
jne    11b6 <plota+0x76>
mov    $0x1,%edi
call   1060 <_chlnmod@plt>
movsd  -0x10(%rbp),%xmm0
call   1040 <_cordx@plt>
mov    %eax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <_cordy@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xe2f(%rip),%rdi
xor    %ecx,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11f3 <plota+0xb3>
xor    %edi,%edi
call   1060 <_chlnmod@plt>
jmp    1204 <plota+0xc4>
movl   $0x1,-0x4(%rbp)
jmp    1210 <plota+0xd0>
jmp    1209 <plota+0xc9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plota>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
jne    117c <plota+0x3c>
movsd  %xmm1,0x8(%rsp)
call   1040 <_cordx@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1050 <_cordy@plt>
lea    0xe96(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1203 <plota+0xc3>
mov    $0x1,%ebx
test   $0xfffffffd,%edi
jne    1203 <plota+0xc3>
movsd  %xmm1,0x8(%rsp)
cmp    $0x2,%edi
jne    11db <plota+0x9b>
mov    $0x1,%edi
movsd  %xmm0,0x10(%rsp)
call   1060 <_chlnmod@plt>
movsd  0x10(%rsp),%xmm0
call   1040 <_cordx@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1050 <_cordy@plt>
lea    0xe45(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <_chlnmod@plt>
jmp    1203 <plota+0xc3>
call   1040 <_cordx@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1050 <_cordy@plt>
lea    0xe14(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"M%d %d\0A\00"
@.str.1 = [10 x i8] c"D%d %d\0A%c\00"
define i32 @plota(i32 %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %5
store double %1, double* %6
store double %2, double* %7
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load double, double* %6
%12 = call i32 @_cordx(double %11)
%13 = load double, double* %7
%14 = call i32 @_cordy(double %13)
%15 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14)
br label %40
16: ; preds = %3
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %38
22: ; preds = %19, %16
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @_chlnmod(i32 1)
br label %27
27: ; preds = %25, %22
%28 = load double, double* %6
%29 = call i32 @_cordx(double %28)
%30 = load double, double* %7
%31 = call i32 @_cordy(double %30)
%32 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %31, i32 0)
%33 = load i32, i32* %5
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %37
35: ; preds = %27
%36 = call i32 @_chlnmod(i32 0)
br label %37
37: ; preds = %35, %27
br label %39
38: ; preds = %19
store i32 1, i32* %4
br label %41
39: ; preds = %37
br label %40
40: ; preds = %39, %10
store i32 0, i32* %4
br label %41
41: ; preds = %40, %38
%42 = load i32, i32* %4
ret i32 %42
}

LLVM IR (-O2):
@.str = [8 x i8] c"M%d %d\0A\00"
@.str.1 = [10 x i8] c"D%d %d\0A%c\00"
define i32 @plota(i32 %0, double %1, double %2) {
%4 = icmp eq i32 %0, 1
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = tail call i32 @_cordx(double %1)
%7 = tail call i32 @_cordy(double %2)
%8 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
br label %24
9: ; preds = %3
%10 = and i32 %0, -3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = icmp eq i32 %0, 2
br i1 %13, label %14, label %20
14: ; preds = %12
%15 = tail call i32 @_chlnmod(i32 1)
%16 = tail call i32 @_cordx(double %1)
%17 = tail call i32 @_cordy(double %2)
%18 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17, i32 0)
%19 = tail call i32 @_chlnmod(i32 0)
br label %24
20: ; preds = %12
%21 = tail call i32 @_cordx(double %1)
%22 = tail call i32 @_cordy(double %2)
%23 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22, i32 0)
br label %24
24: ; preds = %5, %14, %20, %9
%25 = phi i32 [ 1, %9 ], [ 0, %20 ], [ 0, %14 ], [ 0, %5 ]
ret i32 %25
}