#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*/ printf(char *, ...);
void polylines(int *x, int *y, int n) {
  printf("%d %d MT\n", (*x++), (*y++));
  while (--n > 0)
    printf("%d %d LT\n", (*x++), (*y++));
  printf("ST\n");
}


x86 assembly (clang, -O0):
<polylines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%edx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    119a <polylines+0x8a>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%edx
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1153 <polylines+0x43>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polylines>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rdi),%esi
mov    (%r14),%edx
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebp
jl     117e <polylines+0x5e>
add    $0x1,%ebp
mov    $0x4,%ebx
lea    0xeb3(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,1),%esi
mov    (%r14,%rbx,1),%edx
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x4,%rbx
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
ja     1160 <polylines+0x40>
lea    0xe8f(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d MT\0A\00"
@.str.1 = [10 x i8] c"%d %d LT\0A\00"
@.str.2 = [4 x i8] c"ST\0A\00"
define void @polylines(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i32 1
store i32* %8, i32** %4
%9 = load i32, i32* %7
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i32 1
store i32* %11, i32** %5
%12 = load i32, i32* %10
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %12)
br label %14
14: ; preds = %18, %3
%15 = load i32, i32* %6
%16 = add nsw i32 %15, -1
store i32 %16, i32* %6
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i32 1
store i32* %20, i32** %4
%21 = load i32, i32* %19
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i32 1
store i32* %23, i32** %5
%24 = load i32, i32* %22
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %24)
br label %14
26: ; preds = %14
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d MT\0A\00"
@.str.1 = [10 x i8] c"%d %d LT\0A\00"
@str = [3 x i8] c"ST\00"
define void @polylines(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = icmp sgt i32 %2, 1
br i1 %7, label %8, label %19
8: ; preds = %3, %8
%9 = phi i32* [ %13, %8 ], [ %0, %3 ]
%10 = phi i32* [ %12, %8 ], [ %1, %3 ]
%11 = phi i32 [ %14, %8 ], [ %2, %3 ]
%12 = getelementptr inbounds i32, i32* %10, i64 1
%13 = getelementptr inbounds i32, i32* %9, i64 1
%14 = add nsw i32 %11, -1
%15 = load i32, i32* %13
%16 = load i32, i32* %12
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %16)
%18 = icmp ugt i32 %11, 2
br i1 %18, label %8, label %19
19: ; preds = %8, %3
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}