#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ ispunct(char);
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ scrambleWord(char *, int);
int strlen(char *);
int processText(char fileOpen[]) {
  char word[50];
  int length;
  int i;
  FILE *dfp = fopen(fileOpen, "r");
  while (fscanf(dfp, "%s", word) != EOF) {
    length = strlen(word);
    for (i = 0; i < length; i++) {
      if (ispunct(word[i])) {
        length = i;
        break;
      }
    }
    scrambleWord(word, length);
    printf("%s%c", word, fgetc(dfp));
  }
  fclose(dfp);
  return 0;
}


x86 assembly (clang, -O0):
<processText>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe69(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    0xe53(%rip),%rsi
call   1060 <fscanf@plt>
mov    0x2e2d(%rip),%rcx
cmp    (%rcx),%rax
je     124d <processText+0xcd>
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1219 <processText+0x99>
movslq -0x48(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%edi
call   1080 <ispunct@plt>
cmp    $0x0,%rax
je     1206 <processText+0x86>
mov    -0x48(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    1219 <processText+0x99>
jmp    120b <processText+0x8b>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11d7 <processText+0x57>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1090 <scrambleWord@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rdi
call   1070 <fgetc@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    0xdc2(%rip),%rdi
call   1050 <printf@plt>
jmp    11a0 <processText+0x20>
mov    -0x50(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processText>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe6b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r14
lea    0xe5e(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1060 <fscanf@plt>
mov    0x2e32(%rip),%rbp
cmp    0x0(%rbp),%rax
jne    11d5 <processText+0x55>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%r13
lea    0xe23(%rip),%r12
jmp    122b <processText+0xab>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%r15d
mov    %r13,%rdi
mov    %r15d,%esi
call   1090 <scrambleWord@plt>
mov    %r14,%rdi
call   1070 <fgetc@plt>
lea    0xdf8(%rip),%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1060 <fscanf@plt>
cmp    0x0(%rbp),%rax
je     11bc <processText+0x3c>
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
test   %eax,%eax
jle    11f3 <processText+0x73>
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%rsp,%rbx,1),%edi
call   1080 <ispunct@plt>
test   %rax,%rax
jne    11f0 <processText+0x70>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1240 <processText+0xc0>
jmp    11f3 <processText+0x73>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.2 = [5 x i8] c"%s%c\00"
define i32 @processText(i8* %0) {
%2 = alloca i8*
%3 = alloca [50 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %6
br label %9
9: ; preds = %35, %1
%10 = load i32*, i32** %6
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%12 = call i64 @fscanf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i64, i64* @EOF
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %43
15: ; preds = %9
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %4
store i32 0, i32* %5
br label %18
18: ; preds = %32, %15
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %35
22: ; preds = %18
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = call i64 @ispunct(i8 signext %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = load i32, i32* %5
store i32 %30, i32* %4
br label %35
31: ; preds = %22
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %18
35: ; preds = %29, %18
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%37 = load i32, i32* %4
%38 = call i32 @scrambleWord(i8* %36, i32 %37)
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%40 = load i32*, i32** %6
%41 = call i32 @fgetc(i32* %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %39, i32 %41)
br label %9
43: ; preds = %9
%44 = load i32*, i32** %6
%45 = call i32 @fclose(i32* %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.2 = [5 x i8] c"%s%c\00"
define i32 @processText(i8* nocapture %0) {
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i64 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %32, label %8
8: ; preds = %1, %24
%9 = call i32 @strlen(i8* %3)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = zext i32 %9 to i64
br label %13
13: ; preds = %11, %19
%14 = phi i64 [ 0, %11 ], [ %20, %19 ]
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = call i64 @ispunct(i8 signext %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = add nuw nsw i64 %14, 1
%21 = icmp eq i64 %20, %12
br i1 %21, label %24, label %13
22: ; preds = %13
%23 = trunc i64 %14 to i32
br label %24
24: ; preds = %19, %22, %8
%25 = phi i32 [ %9, %8 ], [ %23, %22 ], [ %9, %19 ]
%26 = call i32 @scrambleWord(i8* %3, i32 %25)
%27 = call i32 @fgetc(i32* %4)
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %3, i32 %27)
%29 = call i64 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%30 = load i64, i64* @EOF
%31 = icmp eq i64 %29, %30
br i1 %31, label %32, label %8
32: ; preds = %24, %1
%33 = call i32 @fclose(i32* %4)
ret i32 0
}