#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*/ lp();
int /*<<< orphan*/ sp();
void tapemark(int i) {
  int j = 0;
  for (j = 0; j < i; j++)
    lp();
  for (j = 0; j < i; j++)
    sp();
  lp();
  lp();
}


x86 assembly (clang, -O0):
<tapemark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115a <tapemark+0x3a>
mov    $0x0,%al
call   1040 <lp@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <tapemark+0x19>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1182 <tapemark+0x62>
mov    $0x0,%al
call   1030 <sp@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1161 <tapemark+0x41>
mov    $0x0,%al
call   1040 <lp@plt>
mov    $0x0,%al
call   1040 <lp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tapemark>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    114c <tapemark+0x2c>
mov    %edi,%ebx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <lp@plt>
add    $0xffffffff,%ebp
jne    1130 <tapemark+0x10>
test   %ebx,%ebx
jle    114c <tapemark+0x2c>
xor    %eax,%eax
call   1030 <sp@plt>
add    $0xffffffff,%ebx
jne    1140 <tapemark+0x20>
xor    %eax,%eax
call   1040 <lp@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <lp@plt>

LLVM IR (-O0):
define void @tapemark(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 (...) @lp()
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
store i32 0, i32* %3
br label %14
14: ; preds = %20, %13
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = call i32 (...) @sp()
br label %20
20: ; preds = %18
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %14
23: ; preds = %14
%24 = call i32 (...) @lp()
%25 = call i32 (...) @lp()
ret void
}

LLVM IR (-O2):
define void @tapemark(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %14
3: ; preds = %4
br i1 %2, label %9, label %14
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 (...) @lp()
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
9: ; preds = %3, %9
%10 = phi i32 [ %12, %9 ], [ 0, %3 ]
%11 = tail call i32 (...) @sp()
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %14, label %9
14: ; preds = %9, %1, %3
%15 = tail call i32 (...) @lp()
%16 = tail call i32 (...) @lp()
ret void
}