#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 */
int atoi(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("Ops! need a file name argument \n\n");
    return -1;
  }
  FILE *f;
  char line[80];
  int num;
  f = fopen(argv[1], "r");
  fgets(line, 80, f);
  printf("\n%s \n\n", line);
  num = atoi(line);
  int i;
  for (i = 1; i <= num; i++) {
    if (i % 3 == 0 && i % 5 == 0)
      printf("Hop\n");
    else if (i % 5 == 0)
      printf("HopHop\n");
    else if (i % 3 == 0)
      printf("Hoppity\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    117d <main+0x3d>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1280 <main+0x140>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe96(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x50,%esi
call   1040 <fgets@plt>
lea    -0x70(%rbp),%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x74(%rbp)
movl   $0x1,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x74(%rbp),%eax
jg     1279 <main+0x139>
mov    -0x78(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1213 <main+0xd3>
mov    -0x78(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1213 <main+0xd3>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1266 <main+0x126>
mov    -0x78(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    123a <main+0xfa>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1261 <main+0x121>
mov    -0x78(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    125c <main+0x11c>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1261 <main+0x121>
jmp    1266 <main+0x126>
jmp    126b <main+0x12b>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11cc <main+0x8c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x1,%edi
jg     1179 <main+0x29>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    1231 <main+0xe1>
mov    0x8(%rsi),%rdi
lea    0xe7c(%rip),%rsi
call   1060 <fopen@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x50,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
lea    0xe5f(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
call   1070 <atoi@plt>
test   %eax,%eax
jle    122f <main+0xdf>
mov    %eax,%ebp
mov    $0x1,%ebx
mov    $0xaaaaaaab,%r15d
mov    $0xcccccccd,%r12d
lea    0xe41(%rip),%r13
lea    0xe37(%rip),%r14
jmp    11ed <main+0x9d>
nopl   0x0(%rax)
call   1030 <puts@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
je     122f <main+0xdf>
mov    %ebx,%ecx
mov    %rcx,%rax
imul   %r15,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%edx
mov    %ebx,%eax
sub    %edx,%eax
imul   %r12,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%edx
mov    %ebx,%ecx
sub    %edx,%ecx
mov    %eax,%edx
or     %ecx,%edx
mov    %r13,%rdi
je     11e0 <main+0x90>
mov    %r14,%rdi
test   %ecx,%ecx
je     1227 <main+0xd7>
lea    0xde2(%rip),%rdi
je     11e0 <main+0x90>
test   %eax,%eax
jne    11e5 <main+0x95>
jmp    11e0 <main+0x90>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Ops! need a file name argument \0A\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"\0A%s \0A\0A\00"
@.str.3 = [5 x i8] c"Hop\0A\00"
@.str.4 = [8 x i8] c"HopHop\0A\00"
@.str.5 = [9 x i8] c"Hoppity\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [80 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %59
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %6
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%20 = load i32*, i32** %6
%21 = call i32 @fgets(i8* %19, i32 80, i32* %20)
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %8
store i32 1, i32* %9
br label %26
26: ; preds = %55, %14
%27 = load i32, i32* %9
%28 = load i32, i32* %8
%29 = icmp sle i32 %27, %28
br i1 %29, label %30, label %58
30: ; preds = %26
%31 = load i32, i32* %9
%32 = srem i32 %31, 3
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load i32, i32* %9
%36 = srem i32 %35, 5
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %54
40: ; preds = %34, %30
%41 = load i32, i32* %9
%42 = srem i32 %41, 5
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %53
46: ; preds = %40
%47 = load i32, i32* %9
%48 = srem i32 %47, 3
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %52
52: ; preds = %50, %46
br label %53
53: ; preds = %52, %44
br label %54
54: ; preds = %53, %38
br label %55
55: ; preds = %54
%56 = load i32, i32* %9
%57 = add nsw i32 %56, 1
store i32 %57, i32* %9
br label %26
58: ; preds = %26
store i32 0, i32* %3
br label %59
59: ; preds = %58, %12
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"\0A%s \0A\0A\00"
@str = [8 x i8] c"Hoppity\00"
@str.6 = [7 x i8] c"HopHop\00"
@str.7 = [4 x i8] c"Hop\00"
@str.8 = [33 x i8] c"Ops! need a file name argument \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0))
br label %34
7: ; preds = %2
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @fgets(i8* %8, i32 80, i32* %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%14 = call i32 @atoi(i8* %8)
%15 = icmp slt i32 %14, 1
br i1 %15, label %33, label %16
16: ; preds = %7, %30
%17 = phi i32 [ %31, %30 ], [ 1, %7 ]
%18 = urem i32 %17, 3
%19 = urem i32 %17, 5
%20 = or i32 %18, %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %16
%23 = icmp eq i32 %18, 0
%24 = icmp eq i32 %19, 0
%25 = or i1 %24, %23
%26 = select i1 %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0)
br i1 %25, label %27, label %30
27: ; preds = %22, %16
%28 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.7, i64 0, i64 0), %16 ], [ %26, %22 ]
%29 = call i32 @puts(i8* dereferenceable(1) %28)
br label %30
30: ; preds = %22, %27
%31 = add nuw i32 %17, 1
%32 = icmp eq i32 %17, %14
br i1 %32, label %33, label %16
33: ; preds = %30, %7
br label %34
34: ; preds = %33, %5
%35 = phi i32 [ -1, %5 ], [ 0, %33 ]
ret i32 %35
}