#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 *, double, double, double, double);
int strlen(char *);
void print_data(char pattern[]) {
  double posn = 24;
  int length = strlen(pattern);
  int i;
  for (i = 0; i < length; i++) {
    if ((i % 2) == 0) {
      printf("        <polygon points=\"%.2f,4.00 %.2f,4.00 %.2f,32.00 "
             "%.2f,32.00\" />\n",
             posn, posn + (pattern[i] - '0'), posn + (pattern[i] - '0') + 11.6,
             posn + 11.6);
    }
    posn += (pattern[i] - '0');
  }
}


x86 assembly (clang, -O0):
<print_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f9 <print_data+0xd9>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ce <print_data+0xae>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
cvtsi2sd %eax,%xmm2
addsd  %xmm2,%xmm1
movsd  -0x10(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
cvtsi2sd %eax,%xmm3
addsd  %xmm3,%xmm2
movsd  0xe57(%rip),%xmm3
addsd  %xmm3,%xmm2
movsd  0xe4b(%rip),%xmm3
addsd  -0x10(%rbp),%xmm3
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <print_data+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_data>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
call   1030 <strlen@plt>
test   %eax,%eax
jle    11b0 <print_data+0x90>
mov    %eax,%r15d
movsd  0xec1(%rip),%xmm0
xor    %ebx,%ebx
lea    0xec8(%rip),%r14
jmp    116c <print_data+0x4c>
nopw   0x0(%rax,%rax,1)
movsbl (%r12,%rbx,1),%eax
add    $0xffffffd0,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%rbx
cmp    %rbx,%r15
je     11b0 <print_data+0x90>
test   $0x1,%bl
jne    1150 <print_data+0x30>
movsbl (%r12,%rbx,1),%eax
add    $0xffffffd0,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
movsd  0xe78(%rip),%xmm4
addsd  %xmm4,%xmm2
movapd %xmm0,%xmm3
addsd  %xmm4,%xmm3
mov    %r14,%rdi
movsd  %xmm0,(%rsp)
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
jmp    1150 <print_data+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [72 x i8] c" <polygon points=\22%.2f,4.00 %.2f,4.00 %.2f,32.00 %.2f,32.00\22 />\0A\00"
define void @print_data(i8* %0) {
%2 = alloca i8*
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store double 2.400000e+01, double* %3
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %53, %1
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %56
12: ; preds = %8
%13 = load i32, i32* %5
%14 = srem i32 %13, 2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %42
16: ; preds = %12
%17 = load double, double* %3
%18 = load double, double* %3
%19 = load i8*, i8** %2
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = sub nsw i32 %24, 48
%26 = sitofp i32 %25 to double
%27 = fadd double %18, %26
%28 = load double, double* %3
%29 = load i8*, i8** %2
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 48
%36 = sitofp i32 %35 to double
%37 = fadd double %28, %36
%38 = fadd double %37, 1.160000e+01
%39 = load double, double* %3
%40 = fadd double %39, 1.160000e+01
%41 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), double %17, double %27, double %38, double %40)
br label %42
42: ; preds = %16, %12
%43 = load i8*, i8** %2
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = sub nsw i32 %48, 48
%50 = sitofp i32 %49 to double
%51 = load double, double* %3
%52 = fadd double %51, %50
store double %52, double* %3
br label %53
53: ; preds = %42
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
br label %8
56: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [72 x i8] c" <polygon points=\22%.2f,4.00 %.2f,4.00 %.2f,32.00 %.2f,32.00\22 />\0A\00"
define void @print_data(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %30
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %21
%7 = phi i64 [ 0, %4 ], [ %28, %21 ]
%8 = phi double [ 2.400000e+01, %4 ], [ %27, %21 ]
%9 = and i64 %7, 1
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %0, i64 %7
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = add nsw i32 %14, -48
%16 = sitofp i32 %15 to double
%17 = fadd double %8, %16
%18 = fadd double %17, 1.160000e+01
%19 = fadd double %8, 1.160000e+01
%20 = tail call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), double %8, double %17, double %18, double %19)
br label %21
21: ; preds = %11, %6
%22 = getelementptr inbounds i8, i8* %0, i64 %7
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = add nsw i32 %24, -48
%26 = sitofp i32 %25 to double
%27 = fadd double %8, %26
%28 = add nuw nsw i64 %7, 1
%29 = icmp eq i64 %28, %5
br i1 %29, label %30, label %6
30: ; preds = %21, %1
ret void
}