#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 EXIT_FAILURE;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int random();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  if (argc < 2) {
    return EXIT_FAILURE;
  }
  FILE *fptr = fopen(argv[1], "r");
  if (fptr == NULL) {
    return EXIT_FAILURE;
  }
  char name[80];
  srand(time(NULL));
  while (fgets(name, 80, fptr) != NULL) {
    printf("%d ", (int)(random() % 100 + 1));
    printf("%s", name);
  }
  fclose(fptr);
  return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a1 <main+0x31>
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    124f <main+0xdf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe50(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11d5 <main+0x65>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    124f <main+0xdf>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x50,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     123a <main+0xca>
mov    $0x0,%al
call   1080 <random@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1,%esi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e5 <main+0x75>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x1,%edi
jle    123c <main+0xcc>
mov    0x8(%rsi),%rdi
lea    0xe71(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     123c <main+0xcc>
mov    %rax,%r12
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    %rsp,%rdi
mov    $0x50,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1234 <main+0xc4>
lea    0xe38(%rip),%r14
lea    0xe35(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1080 <random@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    11e0 <main+0x70>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [3 x i8] c"%s\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]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32, i32* @EXIT_FAILURE
store i32 %11, i32* %3
br label %40
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %3
br label %40
21: ; preds = %12
%22 = call i32 @time(i32* null)
%23 = call i32 @srand(i32 %22)
br label %24
24: ; preds = %29, %21
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%26 = load i32*, i32** %6
%27 = call i32* @fgets(i8* %25, i32 80, i32* %26)
%28 = icmp ne i32* %27, null
br i1 %28, label %29, label %36
29: ; preds = %24
%30 = call i32 (...) @random()
%31 = srem i32 %30, 100
%32 = add nsw i32 %31, 1
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %34)
br label %24
36: ; preds = %24
%37 = load i32*, i32** %6
%38 = call i32 @fclose(i32* %37)
%39 = load i32, i32* @EXIT_FAILURE
store i32 %39, i32* %3
br label %40
40: ; preds = %36, %19, %10
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [3 x i8] c"%s\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 = load i32, i32* @EXIT_FAILURE
br label %31
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = load i32, i32* @EXIT_FAILURE
br label %31
14: ; preds = %7
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%16 = tail call i32 @time(i32* null)
%17 = tail call i32 @srand(i32 %16)
%18 = call i32* @fgets(i8* %15, i32 80, i32* %10)
%19 = icmp eq i32* %18, null
br i1 %19, label %28, label %20
20: ; preds = %14, %20
%21 = call i32 (...) @random()
%22 = srem i32 %21, 100
%23 = add nsw i32 %22, 1
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%26 = call i32* @fgets(i8* %15, i32 80, i32* %10)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %20
28: ; preds = %20, %14
%29 = call i32 @fclose(i32* %10)
%30 = load i32, i32* @EXIT_FAILURE
br label %31
31: ; preds = %12, %28, %5
%32 = phi i32 [ %6, %5 ], [ %13, %12 ], [ %30, %28 ]
ret i32 %32
}