#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, unsigned int *, unsigned int *,
                  unsigned int *, unsigned int *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  FILE *fp;
  unsigned v, z, w, h;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fscanf(fp, "Vampires: %d, Zombies: %d, Witches: %d, Houses: %d\n", &v,
                &z, &w, &h) != EOF)
    printf("%d\n",
           v + z + w == 0 ? 0 : (v * 3 + z * 4 + w * 5) * h / (v + z + w));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1171 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1223 <main+0xf3>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe87(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe75(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
call   1040 <fscanf@plt>
mov    0x2e2d(%rip),%rcx
cmp    (%rcx),%rax
je     121c <main+0xec>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    $0x0,%eax
jne    11e0 <main+0xb0>
xor    %eax,%eax
mov    %eax,-0x2c(%rbp)
jmp    1206 <main+0xd6>
imul   $0x3,-0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
imul   $0x5,-0x24(%rbp),%ecx
add    %ecx,%eax
imul   -0x28(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
add    -0x24(%rbp),%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <main+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    1215 <main+0xe5>
mov    0x8(%rsi),%rdi
lea    0xec0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xeb3(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    0x2e64(%rip),%rcx
xor    %r15d,%r15d
cmp    (%rcx),%rax
je     122c <main+0xfc>
lea    0x14(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbp
lea    0x8(%rsp),%r14
xor    %r15d,%r15d
jmp    11e5 <main+0xb5>
nopl   0x0(%rax)
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
lea    0xe4c(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
mov    %r14,%r9
call   1040 <fscanf@plt>
mov    0x2e08(%rip),%rcx
cmp    (%rcx),%rax
je     122c <main+0xfc>
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%eax
lea    (%rax,%rdx,1),%ecx
mov    0xc(%rsp),%edi
mov    $0x0,%esi
add    %edi,%ecx
je     11b0 <main+0x80>
lea    (%rdx,%rdx,2),%edx
lea    (%rdx,%rax,4),%edx
lea    (%rdi,%rdi,4),%eax
add    %edx,%eax
imul   0x8(%rsp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%esi
jmp    11b0 <main+0x80>
mov    (%rsi),%rsi
lea    0xde1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [52 x i8] c"Vampires: %d, Zombies: %d, Witches: %d, Houses: %d\0A\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %57
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i32 1
store i8** %20, i8*** %5
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %6
br label %23
23: ; preds = %53, %18
%24 = load i32*, i32** %6
%25 = call i64 @fscanf(i32* %24, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32* %7, i32* %8, i32* %9, i32* %10)
%26 = load i64, i64* @EOF
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %56
28: ; preds = %23
%29 = load i32, i32* %7
%30 = load i32, i32* %8
%31 = add i32 %29, %30
%32 = load i32, i32* %9
%33 = add i32 %31, %32
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %28
br label %53
36: ; preds = %28
%37 = load i32, i32* %7
%38 = mul i32 %37, 3
%39 = load i32, i32* %8
%40 = mul i32 %39, 4
%41 = add i32 %38, %40
%42 = load i32, i32* %9
%43 = mul i32 %42, 5
%44 = add i32 %41, %43
%45 = load i32, i32* %10
%46 = mul i32 %44, %45
%47 = load i32, i32* %7
%48 = load i32, i32* %8
%49 = add i32 %47, %48
%50 = load i32, i32* %9
%51 = add i32 %49, %50
%52 = udiv i32 %46, %51
br label %53
53: ; preds = %36, %35
%54 = phi i32 [ 0, %35 ], [ %52, %36 ]
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %54)
br label %23
56: ; preds = %23
store i32 0, i32* %3
br label %57
57: ; preds = %56, %13
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [52 x i8] c"Vampires: %d, Zombies: %d, Witches: %d, Houses: %d\0A\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i32 %0, 2
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %44
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = call i64 @fscanf(i32* %18, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%20 = load i64, i64* @EOF
%21 = icmp eq i64 %19, %20
br i1 %21, label %44, label %22
22: ; preds = %15, %38
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = add i32 %24, %23
%26 = load i32, i32* %5
%27 = add i32 %25, %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %38, label %29
29: ; preds = %22
%30 = mul i32 %23, 3
%31 = shl i32 %24, 2
%32 = add i32 %31, %30
%33 = mul i32 %26, 5
%34 = add i32 %32, %33
%35 = load i32, i32* %6
%36 = mul i32 %35, %34
%37 = udiv i32 %36, %27
br label %38
38: ; preds = %22, %29
%39 = phi i32 [ %37, %29 ], [ 0, %22 ]
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = call i64 @fscanf(i32* %18, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%42 = load i64, i64* @EOF
%43 = icmp eq i64 %41, %42
br i1 %43, label %44, label %22
44: ; preds = %38, %15, %12
%45 = phi i32 [ 1, %12 ], [ 0, %15 ], [ 0, %38 ]
ret i32 %45
}