#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 /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char word[11];
  int numWords, i, j;
  FILE *inpt;
  inpt = fopen("letters.in", "r");
  fscanf(inpt, "%d\n", &numWords);
  for (i = 0; i < numWords; i++) {
    fscanf(inpt, "%s", word);
    for (j = 0; word[j] != '\0'; j++)
      if (word[j] == 'l')
        word[j] = 'w';
    printf("%s\n", word);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xeac(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11fa <main+0xca>
mov    -0x28(%rbp),%rdi
lea    -0xf(%rbp),%rdx
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
movsbl -0xf(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11dc <main+0xac>
movslq -0x1c(%rbp),%rax
movsbl -0xf(%rbp,%rax,1),%eax
cmp    $0x6c,%eax
jne    11c9 <main+0x99>
movslq -0x1c(%rbp),%rax
movb   $0x77,-0xf(%rbp,%rax,1)
jmp    11ce <main+0x9e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119c <main+0x6c>
lea    -0xf(%rbp),%rsi
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1173 <main+0x43>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r15
lea    0xeb4(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1040 <fscanf@plt>
cmpl   $0x0,(%rsp)
jle    11d6 <main+0xa6>
lea    0xe9e(%rip),%r14
lea    0x5(%rsp),%rbx
lea    0xe95(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    %rbx,%rax
jmp    11b7 <main+0x87>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x77,(%rax)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x6c,%cl
je     11b0 <main+0x80>
test   %cl,%cl
jne    11b3 <main+0x83>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    (%rsp),%ebp
jl     1190 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"letters.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %0, %19
%10 = phi i32 [ %21, %19 ], [ 0, %0 ]
%11 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
br label %12
12: ; preds = %17, %9
%13 = phi i64 [ %18, %17 ], [ 0, %9 ]
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
switch i8 %15, label %17 [
i8 0, label %19
i8 108, label %16
]
16: ; preds = %12
store i8 119, i8* %14
br label %17
17: ; preds = %12, %16
%18 = add nuw i64 %13, 1
br label %12
19: ; preds = %12
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%21 = add nuw nsw i32 %10, 1
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %9, label %24
24: ; preds = %19, %0
ret i32 0
}