#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 */

/* Variables and functions */
int /*<<< orphan*/ free_file();
int /*<<< orphan*/ read_file(char *);
int /*<<< orphan*/ scale_file();
int /*<<< orphan*/ write_file(char *);
void stl_norm(int argc, char **argv) {
  int i;
  if (!argc) {
  } else {
    for (i = 0; i < argc; i++) {
      read_file(argv[i]);
      scale_file();
      write_file(argv[i]);
      free_file();
    }
  }
}


x86 assembly (clang, -O0):
<stl_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    115e <stl_norm+0x1e>
jmp    11b4 <stl_norm+0x74>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11af <stl_norm+0x6f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <read_file@plt>
mov    $0x0,%al
call   1050 <scale_file@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <write_file@plt>
mov    $0x0,%al
call   1060 <free_file@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <stl_norm+0x25>
jmp    11b4 <stl_norm+0x74>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stl_norm>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1189 <stl_norm+0x49>
mov    %rsi,%r15
mov    %edi,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
call   1040 <read_file@plt>
xor    %eax,%eax
call   1050 <scale_file@plt>
mov    (%r15,%rbx,8),%rdi
call   1030 <write_file@plt>
xor    %eax,%eax
call   1060 <free_file@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1160 <stl_norm+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @stl_norm(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %2
br label %33
9: ; preds = %2
store i32 0, i32* %5
br label %10
10: ; preds = %29, %9
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %32
14: ; preds = %10
%15 = load i8**, i8*** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @read_file(i8* %19)
%21 = call i32 (...) @scale_file()
%22 = load i8**, i8*** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @write_file(i8* %26)
%28 = call i32 (...) @free_file()
br label %29
29: ; preds = %14
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %10
32: ; preds = %10
br label %33
33: ; preds = %32, %8
ret void
}

LLVM IR (-O2):
define void @stl_norm(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %15, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @read_file(i8* %9)
%11 = tail call i32 (...) @scale_file()
%12 = load i8*, i8** %8
%13 = tail call i32 @write_file(i8* %12)
%14 = tail call i32 (...) @free_file()
%15 = add nuw nsw i64 %7, 1
%16 = icmp eq i64 %15, %5
br i1 %16, label %17, label %6
17: ; preds = %6, %2
ret void
}