#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*/ attack_blows(int, int, int, int *, int *, int *);
double critical_blow(int, double, double, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ get_stat(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int scanf(char *, int *, ...);
int main() {
  int cstr, cdex, player_level;
  int weight[100];
  double to_hit[100], to_dam[100], weapon_dam[100];
  int num_weapons, i;
  int max_blows, real_blows;
  int adj_weight;
  double avg_dam, critical;
  int num_die, die_sides;
  printf("Enter level of your character: ");
  if (1 != scanf(" %d", &player_level)) {
    putchar('\n');
    exit(1);
  }
  printf("Enter number of weapons: ");
  if (1 != scanf(" %d", &num_weapons)) {
    putchar('\n');
    exit(1);
  }
  for (i = 0; i < num_weapons; i++) {
    printf("Enter weight, weapon_dam, to_hit, to_dam for weapon #%d: ", i);
    if (5 != scanf(" %d %dd%d %lf %lf", &weight[i], &num_die, &die_sides,
                   &to_hit[i], &to_dam[i])) {
      putchar('\n');
      exit(1);
    }
    weapon_dam[i] = (num_die * die_sides + num_die) / 2.;
  }
  while (1) {
    printf("Enter cstr, cdex: ");
    if (!get_stat(&cstr) || !get_stat(&cdex)) {
      putchar('\n');
      exit(1);
    }
    if (cstr == 0 && cdex == 0)
      break;
    printf("  Weapon | Max blows | Blows | weight ratio | hp of dam |");
    printf(" w/ critical |\n");
    for (i = 0; i < num_weapons; i++) {
      attack_blows(weight[i], cstr, cdex, &max_blows, &real_blows, &adj_weight);
      avg_dam = (int)(real_blows * weapon_dam[i]);
      critical = critical_blow(weight[i], to_hit[i], avg_dam, player_level);
      avg_dam += (int)real_blows * to_dam[i];
      critical += (int)real_blows * to_dam[i];
      printf("  %4d   | %6d    | %4d  | %8d     | %6g    |  %7g    |\n", i,
             max_blows, real_blows, adj_weight, avg_dam, critical);
    }
    printf("\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     11c5 <main+0x55>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4e(%rip),%rdi
lea    -0xb04(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     120b <main+0x9b>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movl   $0x0,-0xb08(%rbp)
mov    -0xb08(%rbp),%eax
cmp    -0xb04(%rbp),%eax
jge    1300 <main+0x190>
mov    -0xb08(%rbp),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0xb08(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
movslq -0xb08(%rbp),%rax
lea    -0x4c0(%rbp),%r8
shl    $0x3,%rax
add    %rax,%r8
movslq -0xb08(%rbp),%rax
lea    -0x7e0(%rbp),%r9
shl    $0x3,%rax
add    %rax,%r9
lea    0xdff(%rip),%rdi
lea    -0xb2c(%rbp),%rdx
lea    -0xb30(%rbp),%rcx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    %eax,%ecx
mov    $0x5,%eax
cmp    %ecx,%eax
je     12b9 <main+0x149>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0xb2c(%rbp),%eax
imul   -0xb30(%rbp),%eax
add    -0xb2c(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xd28(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0xb08(%rbp),%rax
movsd  %xmm0,-0xb00(%rbp,%rax,8)
ff ff
mov    -0xb08(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb08(%rbp)
jmp    1215 <main+0xa5>
jmp    1305 <main+0x195>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1070 <get_stat@plt>
cmp    $0x0,%eax
je     1337 <main+0x1c7>
lea    -0xc(%rbp),%rdi
call   1070 <get_stat@plt>
cmp    $0x0,%eax
jne    134b <main+0x1db>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1364 <main+0x1f4>
cmpl   $0x0,-0xc(%rbp)
jne    1364 <main+0x1f4>
jmp    14e6 <main+0x376>
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xb08(%rbp)
mov    -0xb08(%rbp),%eax
cmp    -0xb04(%rbp),%eax
jge    14d3 <main+0x363>
movslq -0xb08(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0xb0c(%rbp),%rcx
lea    -0xb10(%rbp),%r8
lea    -0xb14(%rbp),%r9
call   1080 <attack_blows@plt>
cvtsi2sdl -0xb10(%rbp),%xmm0
ff
movslq -0xb08(%rbp),%rax
mulsd  -0xb00(%rbp,%rax,8),%xmm0
ff ff
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xb20(%rbp)
ff
movslq -0xb08(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%edi
movslq -0xb08(%rbp),%rax
movsd  -0x4c0(%rbp,%rax,8),%xmm0
ff ff
movsd  -0xb20(%rbp),%xmm1
ff
mov    -0x10(%rbp),%esi
call   1040 <critical_blow@plt>
movsd  %xmm0,-0xb28(%rbp)
ff
cvtsi2sdl -0xb10(%rbp),%xmm0
ff
movslq -0xb08(%rbp),%rax
movsd  -0x7e0(%rbp,%rax,8),%xmm2
ff ff
movsd  -0xb20(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb20(%rbp)
ff
cvtsi2sdl -0xb10(%rbp),%xmm0
ff
movslq -0xb08(%rbp),%rax
movsd  -0x7e0(%rbp,%rax,8),%xmm2
ff ff
movsd  -0xb28(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb28(%rbp)
ff
mov    -0xb08(%rbp),%esi
mov    -0xb0c(%rbp),%edx
mov    -0xb10(%rbp),%ecx
mov    -0xb14(%rbp),%r8d
movsd  -0xb20(%rbp),%xmm0
ff
movsd  -0xb28(%rbp),%xmm1
ff
lea    0xc37(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0xb08(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb08(%rbp)
jmp    138a <main+0x21a>
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1305 <main+0x195>
xor    %eax,%eax
add    $0xb30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb38,%rsp
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe82(%rip),%rdi
lea    0x2c(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    140b <main+0x28b>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe58(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    140b <main+0x28b>
cmpl   $0x0,0xc(%rsp)
jle    1297 <main+0x117>
lea    0x4f0(%rsp),%r14
lea    0x810(%rsp),%rbp
lea    0x40(%rsp),%rbx
lea    0x20(%rsp),%r13
lea    0x1c(%rsp),%r15
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe1f(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe48(%rip),%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %rbp,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1070 <scanf@plt>
cmp    $0x5,%eax
jne    140b <main+0x28b>
mov    0x20(%rsp),%eax
mov    0x1c(%rsp),%ecx
imul   %eax,%ecx
add    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  0xd8d(%rip),%xmm0
movsd  %xmm0,0x1d0(%rsp,%r12,8)
add    $0x1,%r12
movslq 0xc(%rsp),%rax
add    $0x8,%r14
add    $0x8,%rbp
add    $0x4,%rbx
cmp    %rax,%r12
jl     1220 <main+0xa0>
lea    0xdf4(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10(%rsp),%rdi
call   1080 <get_stat@plt>
test   %eax,%eax
je     140b <main+0x28b>
lea    0x28(%rsp),%r13
lea    0x14(%rsp),%rbx
lea    0x24(%rsp),%rbp
lea    0xe12(%rip),%r14
lea    0x10(%rsp),%r12
jmp    1308 <main+0x188>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xda1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
call   1080 <get_stat@plt>
test   %eax,%eax
je     140b <main+0x28b>
lea    0x18(%rsp),%rdi
call   1080 <get_stat@plt>
test   %eax,%eax
je     140b <main+0x28b>
mov    0x10(%rsp),%eax
or     0x18(%rsp),%eax
je     13f7 <main+0x277>
lea    0xd76(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdda(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    12e0 <main+0x160>
xor    %r15d,%r15d
nopl   0x0(%rax)
mov    0x40(%rsp,%r15,4),%edi
mov    0x10(%rsp),%esi
mov    0x18(%rsp),%edx
mov    %r13,%rcx
mov    %rbx,%r8
mov    %rbp,%r9
call   1090 <attack_blows@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x14(%rsp),%xmm0
mulsd  0x1d0(%rsp,%r15,8),%xmm0
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm1
movaps %xmm1,0x30(%rsp)
mov    0x40(%rsp,%r15,4),%edi
movsd  0x810(%rsp,%r15,8),%xmm0
mov    0x2c(%rsp),%esi
call   1050 <critical_blow@plt>
mov    0x14(%rsp),%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
mulsd  0x4f0(%rsp,%r15,8),%xmm1
movapd 0x30(%rsp),%xmm2
addsd  %xmm1,%xmm2
addsd  %xmm0,%xmm1
mov    0x28(%rsp),%edx
mov    0x24(%rsp),%r8d
mov    %r14,%rdi
mov    %r15d,%esi
movapd %xmm2,%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
add    $0x1,%r15
movslq 0xc(%rsp),%rax
cmp    %rax,%r15
jl     1350 <main+0x1d0>
jmp    12e0 <main+0x160>
xor    %eax,%eax
add    $0xb38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Enter level of your character: \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [26 x i8] c"Enter number of weapons: \00"
@.str.3 = [58 x i8] c"Enter weight, weapon_dam, to_hit, to_dam for weapon #%d: \00"
@.str.4 = [18 x i8] c" %d %dd%d %lf %lf\00"
@.str.5 = [19 x i8] c"Enter cstr, cdex: \00"
@.str.6 = [58 x i8] c" Weapon | Max blows | Blows | weight ratio | hp of dam |\00"
@.str.7 = [16 x i8] c" w/ critical |\0A\00"
@.str.8 = [56 x i8] c" %4d | %6d | %4d | %8d | %6g | %7g |\0A\00"
@.str.9 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i32]
%6 = alloca [100 x double]
%7 = alloca [100 x double]
%8 = alloca [100 x double]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%20 = icmp ne i32 1, %19
br i1 %20, label %21, label %24
21: ; preds = %0
%22 = call i32 @putchar(i8 signext 10)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%27 = icmp ne i32 1, %26
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = call i32 @putchar(i8 signext 10)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %24
store i32 0, i32* %10
br label %32
32: ; preds = %64, %31
%33 = load i32, i32* %10
%34 = load i32, i32* %9
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %67
36: ; preds = %32
%37 = load i32, i32* %10
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %40
%42 = load i32, i32* %10
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [100 x double], [100 x double]* %6, i64 0, i64 %43
%45 = load i32, i32* %10
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100 x double], [100 x double]* %7, i64 0, i64 %46
%48 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32* %41, i32* %16, i32* %17, double* %44, double* %47)
%49 = icmp ne i32 5, %48
br i1 %49, label %50, label %53
50: ; preds = %36
%51 = call i32 @putchar(i8 signext 10)
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %36
%54 = load i32, i32* %16
%55 = load i32, i32* %17
%56 = mul nsw i32 %54, %55
%57 = load i32, i32* %16
%58 = add nsw i32 %56, %57
%59 = sitofp i32 %58 to double
%60 = fdiv double %59, 2.000000e+00
%61 = load i32, i32* %10
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [100 x double], [100 x double]* %8, i64 0, i64 %62
store double %60, double* %63
br label %64
64: ; preds = %53
%65 = load i32, i32* %10
%66 = add nsw i32 %65, 1
store i32 %66, i32* %10
br label %32
67: ; preds = %32
br label %68
68: ; preds = %67, %146
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%70 = call i32 @get_stat(i32* %2)
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = call i32 @get_stat(i32* %3)
%74 = icmp ne i32 %73, 0
br i1 %74, label %78, label %75
75: ; preds = %72, %68
%76 = call i32 @putchar(i8 signext 10)
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %72
%79 = load i32, i32* %2
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %78
%82 = load i32, i32* %3
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %85
84: ; preds = %81
br label %148
85: ; preds = %81, %78
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0))
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %10
br label %88
88: ; preds = %143, %85
%89 = load i32, i32* %10
%90 = load i32, i32* %9
%91 = icmp slt i32 %89, %90
br i1 %91, label %92, label %146
92: ; preds = %88
%93 = load i32, i32* %10
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %94
%96 = load i32, i32* %95
%97 = load i32, i32* %2
%98 = load i32, i32* %3
%99 = call i32 @attack_blows(i32 %96, i32 %97, i32 %98, i32* %11, i32* %12, i32* %13)
%100 = load i32, i32* %12
%101 = sitofp i32 %100 to double
%102 = load i32, i32* %10
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [100 x double], [100 x double]* %8, i64 0, i64 %103
%105 = load double, double* %104
%106 = fmul double %101, %105
%107 = fptosi double %106 to i32
%108 = sitofp i32 %107 to double
store double %108, double* %14
%109 = load i32, i32* %10
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %110
%112 = load i32, i32* %111
%113 = load i32, i32* %10
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [100 x double], [100 x double]* %6, i64 0, i64 %114
%116 = load double, double* %115
%117 = load double, double* %14
%118 = load i32, i32* %4
%119 = call double @critical_blow(i32 %112, double %116, double %117, i32 %118)
store double %119, double* %15
%120 = load i32, i32* %12
%121 = sitofp i32 %120 to double
%122 = load i32, i32* %10
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [100 x double], [100 x double]* %7, i64 0, i64 %123
%125 = load double, double* %124
%126 = load double, double* %14
%127 = call double @llvm.fmuladd.f64(double %121, double %125, double %126)
store double %127, double* %14
%128 = load i32, i32* %12
%129 = sitofp i32 %128 to double
%130 = load i32, i32* %10
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [100 x double], [100 x double]* %7, i64 0, i64 %131
%133 = load double, double* %132
%134 = load double, double* %15
%135 = call double @llvm.fmuladd.f64(double %129, double %133, double %134)
store double %135, double* %15
%136 = load i32, i32* %10
%137 = load i32, i32* %11
%138 = load i32, i32* %12
%139 = load i32, i32* %13
%140 = load double, double* %14
%141 = load double, double* %15
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i32 %136, i32 %137, i32 %138, i32 %139, double %140, double %141)
br label %143
143: ; preds = %92
%144 = load i32, i32* %10
%145 = add nsw i32 %144, 1
store i32 %145, i32* %10
br label %88
146: ; preds = %88
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %68
148: ; preds = %84
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Enter level of your character: \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [26 x i8] c"Enter number of weapons: \00"
@.str.3 = [58 x i8] c"Enter weight, weapon_dam, to_hit, to_dam for weapon #%d: \00"
@.str.4 = [18 x i8] c" %d %dd%d %lf %lf\00"
@.str.5 = [19 x i8] c"Enter cstr, cdex: \00"
@.str.6 = [58 x i8] c" Weapon | Max blows | Blows | weight ratio | hp of dam |\00"
@.str.8 = [56 x i8] c" %4d | %6d | %4d | %8d | %6g | %7g |\0A\00"
@str = [15 x i8] c" w/ critical |\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i32]
%5 = alloca [100 x double]
%6 = alloca [100 x double]
%7 = alloca [100 x double]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = bitcast i32* %1 to i8*
%15 = bitcast i32* %2 to i8*
%16 = bitcast i32* %3 to i8*
%17 = bitcast [100 x i32]* %4 to i8*
%18 = bitcast [100 x double]* %5 to i8*
%19 = bitcast [100 x double]* %6 to i8*
%20 = bitcast [100 x double]* %7 to i8*
%21 = bitcast i32* %8 to i8*
%22 = bitcast i32* %9 to i8*
%23 = bitcast i32* %10 to i8*
%24 = bitcast i32* %11 to i8*
%25 = bitcast i32* %12 to i8*
%26 = bitcast i32* %13 to i8*
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%28 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%29 = icmp eq i32 %28, 1
br i1 %29, label %33, label %30
30: ; preds = %0
%31 = call i32 @putchar(i8 signext 10)
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %0
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* %8
%39 = icmp sgt i32 %38, 0
br i1 %39, label %47, label %43
40: ; preds = %33
%41 = call i32 @putchar(i8 signext 10)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %59, %37
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%45 = call i32 @get_stat(i32* %1)
%46 = icmp eq i32 %45, 0
br i1 %46, label %74, label %71
47: ; preds = %37, %59
%48 = phi i64 [ %67, %59 ], [ 0, %37 ]
%49 = trunc i64 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%51 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %48
%52 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 %48
%53 = getelementptr inbounds [100 x double], [100 x double]* %6, i64 0, i64 %48
%54 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32* %51, i32* %12, i32* %13, double* %52, double* %53)
%55 = icmp eq i32 %54, 5
br i1 %55, label %59, label %56
56: ; preds = %47
%57 = call i32 @putchar(i8 signext 10)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %47
%60 = load i32, i32* %12
%61 = load i32, i32* %13
%62 = mul nsw i32 %61, %60
%63 = add nsw i32 %62, %60
%64 = sitofp i32 %63 to double
%65 = fmul double %64, 5.000000e-01
%66 = getelementptr inbounds [100 x double], [100 x double]* %7, i64 0, i64 %48
store double %65, double* %66
%67 = add nuw nsw i64 %48, 1
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = icmp slt i64 %67, %69
br i1 %70, label %47, label %43
71: ; preds = %43, %121
%72 = call i32 @get_stat(i32* %2)
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %121, %71, %43
%75 = call i32 @putchar(i8 signext 10)
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %71
%78 = load i32, i32* %1
%79 = icmp eq i32 %78, 0
%80 = load i32, i32* %2
%81 = icmp eq i32 %80, 0
%82 = select i1 %79, i1 %81, i1 false
br i1 %82, label %126, label %83
83: ; preds = %77
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0))
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%86 = load i32, i32* %8
%87 = icmp sgt i32 %86, 0
br i1 %87, label %88, label %121
88: ; preds = %83, %88
%89 = phi i64 [ %117, %88 ], [ 0, %83 ]
%90 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %89
%91 = load i32, i32* %90
%92 = load i32, i32* %1
%93 = load i32, i32* %2
%94 = call i32 @attack_blows(i32 %91, i32 %92, i32 %93, i32* %9, i32* %10, i32* %11)
%95 = load i32, i32* %10
%96 = sitofp i32 %95 to double
%97 = getelementptr inbounds [100 x double], [100 x double]* %7, i64 0, i64 %89
%98 = load double, double* %97
%99 = fmul double %98, %96
%100 = fptosi double %99 to i32
%101 = sitofp i32 %100 to double
%102 = load i32, i32* %90
%103 = getelementptr inbounds [100 x double], [100 x double]* %5, i64 0, i64 %89
%104 = load double, double* %103
%105 = load i32, i32* %3
%106 = call double @critical_blow(i32 %102, double %104, double %101, i32 %105)
%107 = load i32, i32* %10
%108 = sitofp i32 %107 to double
%109 = getelementptr inbounds [100 x double], [100 x double]* %6, i64 0, i64 %89
%110 = load double, double* %109
%111 = call double @llvm.fmuladd.f64(double %108, double %110, double %101)
%112 = call double @llvm.fmuladd.f64(double %108, double %110, double %106)
%113 = load i32, i32* %9
%114 = load i32, i32* %11
%115 = trunc i64 %89 to i32
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i32 %115, i32 %113, i32 %107, i32 %114, double %111, double %112)
%117 = add nuw nsw i64 %89, 1
%118 = load i32, i32* %8
%119 = sext i32 %118 to i64
%120 = icmp slt i64 %117, %119
br i1 %120, label %88, label %121
121: ; preds = %88, %83
%122 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%124 = call i32 @get_stat(i32* %1)
%125 = icmp eq i32 %124, 0
br i1 %125, label %74, label %71
126: ; preds = %77
ret i32 0
}