#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 *, ...);
int battle(int myscore, int oppscore, char name[], char opp[]) {
  int my_stat = myscore;
  int opp_stat = oppscore;
  int i = 0;
  printf("\n%s\n", name);
  for (i = 0; i <= my_stat; ++i) {
    printf("|");
  }
  printf("\n%s\n", opp);
  for (i = 0; i <= opp_stat; ++i) {
    printf("|");
  }
}


x86 assembly (clang, -O0):
<battle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     117a <battle+0x6a>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1152 <battle+0x42>
mov    -0x20(%rbp),%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     11bb <battle+0xab>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1193 <battle+0x83>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<battle>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xece(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
js     115f <battle+0x3f>
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1150 <battle+0x30>
lea    0xe9a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
js     118f <battle+0x6f>
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1180 <battle+0x60>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"\0A%s\0A\00"
define i32 @battle(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = icmp slt i32 %0, 0
br i1 %6, label %12, label %7
7: ; preds = %4, %7
%8 = phi i32 [ %10, %7 ], [ 0, %4 ]
%9 = tail call i32 @putchar(i32 124)
%10 = add nuw i32 %8, 1
%11 = icmp eq i32 %8, %0
br i1 %11, label %12, label %7
12: ; preds = %7, %4
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
%14 = icmp slt i32 %1, 0
br i1 %14, label %20, label %15
15: ; preds = %12, %15
%16 = phi i32 [ %18, %15 ], [ 0, %12 ]
%17 = tail call i32 @putchar(i32 124)
%18 = add nuw i32 %16, 1
%19 = icmp eq i32 %16, %1
br i1 %19, label %20, label %15
20: ; preds = %15, %12
ret i32 undef
}