#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 print_batt(int n) {
  int i, temp;
  temp = 50 - ((n / 2) - 1);
  printf("|");
  for (i = 0; i < (n / 2) - 1; i++)
    printf(">");
  for (i = 0; i < temp - 2; i++)
    printf(" ");
  printf("|");
  printf("\n");
}


x86 assembly (clang, -O0):
<print_batt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
sub    $0x1,%ecx
mov    $0x32,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1183 <print_batt+0x73>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <print_batt+0x38>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    11b5 <print_batt+0xa5>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118a <print_batt+0x7a>
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_batt>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    %edi,%ebp
shr    $0x1f,%ebp
add    %edi,%ebp
sar    %ebp
mov    $0x7c,%edi
call   1030 <putchar@plt>
cmp    $0x4,%r14d
jl     1155 <print_batt+0x45>
cmp    $0x3,%ebp
mov    $0x2,%ebx
cmovge %ebp,%ebx
add    $0xffffffff,%ebx
xchg   %ax,%ax
mov    $0x3e,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1140 <print_batt+0x30>
cmp    $0x61,%r14d
jg     117f <print_batt+0x6f>
mov    $0x31,%eax
sub    %ebp,%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1170 <print_batt+0x60>
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"|\00"
@.str.1 = [2 x i8] c">\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @print_batt(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 2
%7 = sub nsw i32 %6, 1
%8 = sub nsw i32 50, %7
store i32 %8, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %10
10: ; preds = %18, %1
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 2
%14 = sub nsw i32 %13, 1
%15 = icmp slt i32 %11, %14
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %10
21: ; preds = %10
store i32 0, i32* %3
br label %22
22: ; preds = %29, %21
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 2
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %22
32: ; preds = %22
%33 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @print_batt(i32 %0) {
%2 = sdiv i32 %0, 2
%3 = tail call i32 @putchar(i32 124)
%4 = icmp sgt i32 %0, 3
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = call i32 @llvm.smax.i32(i32 %2, i32 2)
%7 = add nsw i32 %6, -1
br label %13
8: ; preds = %13
%9 = icmp slt i32 %0, 98
br i1 %9, label %10, label %23
10: ; preds = %1, %8
%11 = sub nsw i32 49, %2
%12 = call i32 @llvm.smax.i32(i32 %11, i32 1)
br label %18
13: ; preds = %5, %13
%14 = phi i32 [ %16, %13 ], [ 0, %5 ]
%15 = tail call i32 @putchar(i32 62)
%16 = add nuw nsw i32 %14, 1
%17 = icmp eq i32 %16, %7
br i1 %17, label %8, label %13
18: ; preds = %10, %18
%19 = phi i32 [ %21, %18 ], [ 0, %10 ]
%20 = tail call i32 @putchar(i32 32)
%21 = add nuw nsw i32 %19, 1
%22 = icmp eq i32 %21, %12
br i1 %22, label %23, label %18
23: ; preds = %18, %8
%24 = tail call i32 @putchar(i32 124)
%25 = tail call i32 @putchar(i32 10)
ret void
}