#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 char wchar_t;
typedef int ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ LC_ALL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
char *malloc(int);
size_t mbstowcs(char *, char *, size_t);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
char *realloc(char *, size_t);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
int const strlen(char const *);
int /*<<< orphan*/ wcsncpy(char *, char *, size_t const);
int main(int argc, char **argv) {
  if (argc < 2) {
    perror("File name not specified");
    exit(EXIT_FAILURE);
  }
  setlocale(LC_ALL, "");
  const char *tmp_str = ".tmp";
  const ssize_t tmp_str_len = strlen(tmp_str);
  const size_t str_len = 80;
  wchar_t *str = malloc(sizeof(wchar_t) * str_len);
  FILE *fp;
  FILE *fph;
  char *line = NULL;
  size_t len = 0;
  ssize_t read;
  int i;
  char *tmp_file_name;
  size_t tmp_file_name_len;
  size_t mbslen = 0;
  wchar_t *wcs = malloc(0);
  if (wcs == NULL) {
    perror("malloc");
    exit(EXIT_FAILURE);
  }
  size_t j;
  size_t k;
  size_t l;
  for (i = 1; i < argc; i++) {
    fp = fopen(argv[i], "r");
    if (fp == NULL) {
      fprintf(stderr, "Can't open file: %s\n", argv[i]);
      exit(EXIT_FAILURE);
    }
    tmp_file_name_len = strlen(argv[i]) + tmp_str_len;
    tmp_file_name = malloc(sizeof(char) * tmp_file_name_len);
    if (tmp_file_name == NULL) {
      perror("malloc");
      exit(EXIT_FAILURE);
    }
    strcpy(tmp_file_name, argv[i]);
    strcat(tmp_file_name, tmp_str);
    fph = fopen(tmp_file_name, "w+");
    if (fp == NULL) {
      fprintf(stderr, "Can't open/create file: %s\n", tmp_file_name);
      exit(EXIT_FAILURE);
    }
    read = getline(&line, &len, fp);
    while (read != -1) {
      mbslen = read;
      if (mbslen > str_len) {
        mbslen = mbstowcs(NULL, line, 0);
        if (mbslen == (size_t)-1) {
          perror("mbstowcs");
          exit(EXIT_FAILURE);
        }
      }
      if (mbslen > str_len) {
        wcs = realloc(wcs, mbslen * sizeof(wchar_t));
        if (wcs == NULL) {
          perror("realloc");
          exit(EXIT_FAILURE);
        }
        if (mbstowcs(wcs, line, mbslen) == (size_t)-1) {
          perror("mbstowcs");
          exit(EXIT_FAILURE);
        }
        for (j = 0; j < mbslen - 1; j += str_len) {
          k = mbslen - 1 - j;
          if (k > str_len) {
            wcsncpy(str, wcs + j, str_len);
            for (l = str_len - 1; l > 0; l--) {
              if (str[l] == ' ') {
                str[l] = '\0';
                j -= str_len - l - 1;
                break;
              }
            }
          } else {
            wcsncpy(str, wcs + j, k);
            str[k] = '\0';
          }
          fprintf(fph, "%ls\n", str);
        }
      } else {
        fprintf(fph, "%s", line);
      }
      read = getline(&line, &len, fp);
    }
    fclose(fp);
    fclose(fph);
    free(tmp_file_name);
  }
  printf("\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    123d <main+0x3d>
lea    0xdd6(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
lea    0xe0c(%rip),%rsi
call   10d0 <setlocale@plt>
lea    0xdbf(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movq   $0x50,-0x28(%rbp)
mov    $0x50,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x70(%rbp)
xor    %edi,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    12c7 <main+0xc7>
lea    0xd69(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1651 <main+0x451>
mov    -0x10(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd37(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1331 <main+0x131>
mov    0x2cd8(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd08(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
add    -0x1c(%rbp),%eax
cltq
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1383 <main+0x183>
lea    0xcad(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
mov    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1110 <strcat@plt>
mov    -0x60(%rbp),%rdi
lea    0xc8b(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    13ec <main+0x1ec>
mov    0x2c15(%rip),%rax
mov    (%rax),%rdi
mov    -0x60(%rbp),%rdx
lea    0xc65(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2bf3(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    -0x38(%rbp),%rdx
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1100 <getline@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0xffffffff,-0x54(%rbp)
je     1628 <main+0x428>
movslq -0x54(%rbp),%rax
mov    %rax,-0x70(%rbp)
cmpq   $0x50,-0x70(%rbp)
jbe    145b <main+0x25b>
mov    -0x48(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rdi
call   1050 <mbstowcs@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0xffffffffffffffff,-0x70(%rbp)
jne    1456 <main+0x256>
lea    0xc17(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2b89(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
jmp    145b <main+0x25b>
cmpq   $0x50,-0x70(%rbp)
jbe    15fb <main+0x3fb>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%rsi
shl    $0x0,%rsi
call   10c0 <realloc@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    14a0 <main+0x2a0>
lea    0xbd6(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2b3f(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    -0x78(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x70(%rbp),%rdx
call   1050 <mbstowcs@plt>
cmp    $0xffffffffffffffff,%rax
jne    14d5 <main+0x2d5>
lea    0xb98(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2b0a(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
mov    -0x70(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    15f6 <main+0x3f6>
mov    -0x70(%rbp),%rax
sub    $0x1,%rax
sub    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
cmpq   $0x50,-0x88(%rbp)
50
jbe    15aa <main+0x3aa>
mov    -0x30(%rbp),%rdi
mov    -0x78(%rbp),%rsi
add    -0x80(%rbp),%rsi
mov    $0x50,%edx
call   1090 <wcsncpy@plt>
movq   $0x4f,-0x90(%rbp)
cmpq   $0x0,-0x90(%rbp)
jbe    15a5 <main+0x3a5>
mov    -0x30(%rbp),%rax
mov    -0x90(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1589 <main+0x389>
mov    -0x30(%rbp),%rax
mov    -0x90(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    $0x50,%ecx
sub    -0x90(%rbp),%rcx
sub    $0x1,%rcx
mov    -0x80(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x80(%rbp)
jmp    15a5 <main+0x3a5>
jmp    158e <main+0x38e>
mov    -0x90(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x90(%rbp)
jmp    1534 <main+0x334>
jmp    15d1 <main+0x3d1>
mov    -0x30(%rbp),%rdi
mov    -0x78(%rbp),%rsi
add    -0x80(%rbp),%rsi
mov    -0x88(%rbp),%rdx
call   1090 <wcsncpy@plt>
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xa8b(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x80(%rbp),%rax
add    $0x50,%rax
mov    %rax,-0x80(%rbp)
jmp    14dd <main+0x2dd>
jmp    160f <main+0x40f>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rdx
lea    0xa66(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x38(%rbp),%rdx
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1100 <getline@plt>
mov    %eax,-0x54(%rbp)
jmp    1400 <main+0x200>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    12ce <main+0xce>
lea    0xa00(%rip),%rdi
call   1080 <printf@plt>
mov    0x296c(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x1,%edi
jg     122f <main+0x1f>
lea    0xdd6(%rip),%rdi
jmp    14da <main+0x2ca>
mov    %edi,%ebp
mov    %rsi,0x28(%rsp)
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
lea    0xdf4(%rip),%rsi
call   10e0 <setlocale@plt>
lea    0xdc6(%rip),%rdi
call   1080 <strlen@plt>
mov    %eax,%r14d
mov    $0x50,%edi
call   10c0 <malloc@plt>
mov    %rax,%rbx
movq   $0x0,0x8(%rsp)
movq   $0x0,0x18(%rsp)
xor    %edi,%edi
call   10c0 <malloc@plt>
test   %rax,%rax
jne    1291 <main+0x81>
lea    0xd91(%rip),%rdi
jmp    14da <main+0x2ca>
mov    %rax,%r12
mov    %ebp,%eax
mov    %rax,0x20(%rsp)
mov    $0x1,%ebp
mov    %r14,0x40(%rsp)
jmp    12e0 <main+0xd0>
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rdi
call   1070 <fclose@plt>
mov    %rbp,%rdi
call   1070 <fclose@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rbp
add    $0x1,%rbp
cmp    0x20(%rsp),%rbp
je     14ed <main+0x2dd>
mov    0x28(%rsp),%r15
mov    (%r15,%rbp,8),%rdi
lea    0xd34(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     1505 <main+0x2f5>
mov    (%r15,%rbp,8),%rdi
call   1080 <strlen@plt>
lea    (%rax,%r14,1),%edi
call   10c0 <malloc@plt>
test   %rax,%rax
je     1285 <main+0x75>
mov    %rbp,0x38(%rsp)
mov    (%r15,%rbp,8),%rsi
mov    %rax,%rbp
mov    %rax,%rdi
call   1050 <strcpy@plt>
mov    %rbp,%rdi
lea    0xcdc(%rip),%rsi
call   1120 <strcat@plt>
mov    %rbp,0x30(%rsp)
mov    %rbp,%rdi
lea    0xceb(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rbp
jmp    136d <main+0x15d>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
mov    %rbp,%rsi
call   1090 <fputs@plt>
lea    0x8(%rsp),%rdi
lea    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
call   1110 <getline@plt>
cmp    $0xffffffff,%eax
je     12b0 <main+0xa0>
cmp    $0x51,%eax
jb     13c0 <main+0x1b0>
mov    0x8(%rsp),%rsi
xor    %edi,%edi
xor    %edx,%edx
call   1060 <mbstowcs@plt>
mov    %rax,%r15
cmp    $0xffffffffffffffff,%rax
je     14ca <main+0x2ba>
cmp    $0x51,%r15
jb     1360 <main+0x150>
jmp    13c9 <main+0x1b9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %eax,%r15
cmp    $0x51,%r15
jb     1360 <main+0x150>
mov    %r12,%rdi
mov    %r15,%rsi
call   10d0 <realloc@plt>
test   %rax,%rax
je     14d3 <main+0x2c3>
mov    %rax,%r12
mov    0x8(%rsp),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
call   1060 <mbstowcs@plt>
cmp    $0xffffffffffffffff,%rax
je     14ca <main+0x2ba>
add    $0xffffffffffffffff,%r15
xor    %r14d,%r14d
jmp    143f <main+0x22f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %r13,%rdx
call   10a0 <wcsncpy@plt>
movb   $0x0,(%rbx,%r13,1)
mov    %rbp,%rdi
lea    0xc25(%rip),%rsi
mov    %rbx,%rdx
call   10b0 <fprintf@plt>
add    $0x50,%r14
cmp    %r14,%r15
jbe    14c0 <main+0x2b0>
mov    %r15,%r13
sub    %r14,%r13
lea    (%r12,%r14,1),%rsi
cmp    $0x51,%r13
jb     1410 <main+0x200>
mov    $0x50,%edx
mov    %rbx,%rdi
call   10a0 <wcsncpy@plt>
mov    $0x4c,%eax
cmpb   $0x20,0x3(%rbx,%rax,1)
je     1494 <main+0x284>
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,0x2(%rbx,%rax,1)
je     149a <main+0x28a>
cmpb   $0x20,0x1(%rbx,%rax,1)
je     14a0 <main+0x290>
test   %rax,%rax
je     1420 <main+0x210>
cmpb   $0x20,(%rbx,%rax,1)
je     14a4 <main+0x294>
add    $0xfffffffffffffffc,%rax
cmpb   $0x20,0x3(%rbx,%rax,1)
jne    1470 <main+0x260>
add    $0x3,%rax
jmp    14a4 <main+0x294>
add    $0x2,%rax
jmp    14a4 <main+0x294>
add    $0x1,%rax
movb   $0x0,(%rbx,%rax,1)
add    %rax,%r14
add    $0xffffffffffffffb1,%r14
jmp    1420 <main+0x210>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x40(%rsp),%r14
jmp    136d <main+0x15d>
lea    0xb6d(%rip),%rdi
jmp    14da <main+0x2ca>
lea    0xb6d(%rip),%rdi
call   1100 <perror@plt>
mov    0x2af2(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x2ad2(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
mov    0x2ad4(%rip),%rax
mov    (%rax),%rdi
mov    (%r15,%rbp,8),%rdx
lea    0xb0c(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    14df <main+0x2cf>

LLVM IR (-O0):
@.str = [24 x i8] c"File name not specified\00"
@EXIT_FAILURE = global i32 0
@LC_ALL = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c".tmp\00"
@.str.3 = [7 x i8] c"malloc\00"
@.str.4 = [2 x i8] c"r\00"
@stderr = global i32* null
@.str.5 = [21 x i8] c"Can't open file: %s\0A\00"
@.str.6 = [3 x i8] c"w+\00"
@.str.7 = [28 x i8] c"Can't open/create file: %s\0A\00"
@.str.8 = [9 x i8] c"mbstowcs\00"
@.str.9 = [8 x i8] c"realloc\00"
@.str.10 = [5 x i8] c"%ls\0A\00"
@.str.11 = [3 x i8] c"%s\00"
@.str.12 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i64
%18 = alloca i64
%19 = alloca i8*
%20 = alloca i64
%21 = alloca i64
%22 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 2
br i1 %24, label %25, label %29
25: ; preds = %2
%26 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %2
%30 = load i32, i32* @LC_ALL
%31 = call i32 @setlocale(i32 %30, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %6
%32 = load i8*, i8** %6
%33 = call i32 @strlen(i8* %32)
store i32 %33, i32* %7
store i64 80, i64* %8
%34 = call i8* @malloc(i32 80)
store i8* %34, i8** %9
store i8* null, i8** %12
store i64 0, i64* %13
store i64 0, i64* %18
%35 = call i8* @malloc(i32 0)
store i8* %35, i8** %19
%36 = load i8*, i8** %19
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %42
38: ; preds = %29
%39 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32, i32* @EXIT_FAILURE
%41 = call i32 @exit(i32 %40)
unreachable
42: ; preds = %29
store i32 1, i32* %15
br label %43
43: ; preds = %227, %42
%44 = load i32, i32* %15
%45 = load i32, i32* %4
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %230
47: ; preds = %43
%48 = load i8**, i8*** %5
%49 = load i32, i32* %15
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %48, i64 %50
%52 = load i8*, i8** %51
%53 = call i32* @fopen(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %53, i32** %10
%54 = load i32*, i32** %10
%55 = icmp eq i32* %54, null
br i1 %55, label %56, label %66
56: ; preds = %47
%57 = load i32*, i32** @stderr
%58 = load i8**, i8*** %5
%59 = load i32, i32* %15
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
%63 = call i32 @fprintf(i32* %57, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %62)
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %47
%67 = load i8**, i8*** %5
%68 = load i32, i32* %15
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
%72 = call i32 @strlen(i8* %71)
%73 = load i32, i32* %7
%74 = add nsw i32 %72, %73
%75 = sext i32 %74 to i64
store i64 %75, i64* %17
%76 = load i64, i64* %17
%77 = mul i64 1, %76
%78 = trunc i64 %77 to i32
%79 = call i8* @malloc(i32 %78)
store i8* %79, i8** %16
%80 = load i8*, i8** %16
%81 = icmp eq i8* %80, null
br i1 %81, label %82, label %86
82: ; preds = %66
%83 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%84 = load i32, i32* @EXIT_FAILURE
%85 = call i32 @exit(i32 %84)
unreachable
86: ; preds = %66
%87 = load i8*, i8** %16
%88 = load i8**, i8*** %5
%89 = load i32, i32* %15
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8*, i8** %88, i64 %90
%92 = load i8*, i8** %91
%93 = call i32 @strcpy(i8* %87, i8* %92)
%94 = load i8*, i8** %16
%95 = load i8*, i8** %6
%96 = call i32 @strcat(i8* %94, i8* %95)
%97 = load i8*, i8** %16
%98 = call i32* @fopen(i8* %97, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %98, i32** %11
%99 = load i32*, i32** %10
%100 = icmp eq i32* %99, null
br i1 %100, label %101, label %107
101: ; preds = %86
%102 = load i32*, i32** @stderr
%103 = load i8*, i8** %16
%104 = call i32 @fprintf(i32* %102, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %103)
%105 = load i32, i32* @EXIT_FAILURE
%106 = call i32 @exit(i32 %105)
unreachable
107: ; preds = %86
%108 = load i32*, i32** %10
%109 = call i32 @getline(i8** %12, i64* %13, i32* %108)
store i32 %109, i32* %14
br label %110
110: ; preds = %217, %107
%111 = load i32, i32* %14
%112 = icmp ne i32 %111, -1
br i1 %112, label %113, label %220
113: ; preds = %110
%114 = load i32, i32* %14
%115 = sext i32 %114 to i64
store i64 %115, i64* %18
%116 = load i64, i64* %18
%117 = icmp ugt i64 %116, 80
br i1 %117, label %118, label %128
118: ; preds = %113
%119 = load i8*, i8** %12
%120 = call i64 @mbstowcs(i8* null, i8* %119, i64 0)
store i64 %120, i64* %18
%121 = load i64, i64* %18
%122 = icmp eq i64 %121, -1
br i1 %122, label %123, label %127
123: ; preds = %118
%124 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%125 = load i32, i32* @EXIT_FAILURE
%126 = call i32 @exit(i32 %125)
unreachable
127: ; preds = %118
br label %128
128: ; preds = %127, %113
%129 = load i64, i64* %18
%130 = icmp ugt i64 %129, 80
br i1 %130, label %131, label %213
131: ; preds = %128
%132 = load i8*, i8** %19
%133 = load i64, i64* %18
%134 = mul i64 %133, 1
%135 = call i8* @realloc(i8* %132, i64 %134)
store i8* %135, i8** %19
%136 = load i8*, i8** %19
%137 = icmp eq i8* %136, null
br i1 %137, label %138, label %142
138: ; preds = %131
%139 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%140 = load i32, i32* @EXIT_FAILURE
%141 = call i32 @exit(i32 %140)
unreachable
142: ; preds = %131
%143 = load i8*, i8** %19
%144 = load i8*, i8** %12
%145 = load i64, i64* %18
%146 = call i64 @mbstowcs(i8* %143, i8* %144, i64 %145)
%147 = icmp eq i64 %146, -1
br i1 %147, label %148, label %152
148: ; preds = %142
%149 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%150 = load i32, i32* @EXIT_FAILURE
%151 = call i32 @exit(i32 %150)
unreachable
152: ; preds = %142
store i64 0, i64* %20
br label %153
153: ; preds = %209, %152
%154 = load i64, i64* %20
%155 = load i64, i64* %18
%156 = sub i64 %155, 1
%157 = icmp ult i64 %154, %156
br i1 %157, label %158, label %212
158: ; preds = %153
%159 = load i64, i64* %18
%160 = sub i64 %159, 1
%161 = load i64, i64* %20
%162 = sub i64 %160, %161
store i64 %162, i64* %21
%163 = load i64, i64* %21
%164 = icmp ugt i64 %163, 80
br i1 %164, label %165, label %195
165: ; preds = %158
%166 = load i8*, i8** %9
%167 = load i8*, i8** %19
%168 = load i64, i64* %20
%169 = getelementptr inbounds i8, i8* %167, i64 %168
%170 = call i32 @wcsncpy(i8* %166, i8* %169, i64 80)
store i64 79, i64* %22
br label %171
171: ; preds = %191, %165
%172 = load i64, i64* %22
%173 = icmp ugt i64 %172, 0
br i1 %173, label %174, label %194
174: ; preds = %171
%175 = load i8*, i8** %9
%176 = load i64, i64* %22
%177 = getelementptr inbounds i8, i8* %175, i64 %176
%178 = load i8, i8* %177
%179 = sext i8 %178 to i32
%180 = icmp eq i32 %179, 32
br i1 %180, label %181, label %190
181: ; preds = %174
%182 = load i8*, i8** %9
%183 = load i64, i64* %22
%184 = getelementptr inbounds i8, i8* %182, i64 %183
store i8 0, i8* %184
%185 = load i64, i64* %22
%186 = sub i64 80, %185
%187 = sub i64 %186, 1
%188 = load i64, i64* %20
%189 = sub i64 %188, %187
store i64 %189, i64* %20
br label %194
190: ; preds = %174
br label %191
191: ; preds = %190
%192 = load i64, i64* %22
%193 = add i64 %192, -1
store i64 %193, i64* %22
br label %171
194: ; preds = %181, %171
br label %205
195: ; preds = %158
%196 = load i8*, i8** %9
%197 = load i8*, i8** %19
%198 = load i64, i64* %20
%199 = getelementptr inbounds i8, i8* %197, i64 %198
%200 = load i64, i64* %21
%201 = call i32 @wcsncpy(i8* %196, i8* %199, i64 %200)
%202 = load i8*, i8** %9
%203 = load i64, i64* %21
%204 = getelementptr inbounds i8, i8* %202, i64 %203
store i8 0, i8* %204
br label %205
205: ; preds = %195, %194
%206 = load i32*, i32** %11
%207 = load i8*, i8** %9
%208 = call i32 @fprintf(i32* %206, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* %207)
br label %209
209: ; preds = %205
%210 = load i64, i64* %20
%211 = add i64 %210, 80
store i64 %211, i64* %20
br label %153
212: ; preds = %153
br label %217
213: ; preds = %128
%214 = load i32*, i32** %11
%215 = load i8*, i8** %12
%216 = call i32 @fprintf(i32* %214, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* %215)
br label %217
217: ; preds = %213, %212
%218 = load i32*, i32** %10
%219 = call i32 @getline(i8** %12, i64* %13, i32* %218)
store i32 %219, i32* %14
br label %110
220: ; preds = %110
%221 = load i32*, i32** %10
%222 = call i32 @fclose(i32* %221)
%223 = load i32*, i32** %11
%224 = call i32 @fclose(i32* %223)
%225 = load i8*, i8** %16
%226 = call i32 @free(i8* %225)
br label %227
227: ; preds = %220
%228 = load i32, i32* %15
%229 = add nsw i32 %228, 1
store i32 %229, i32* %15
br label %43
230: ; preds = %43
%231 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%232 = load i32, i32* @EXIT_SUCCESS
%233 = call i32 @exit(i32 %232)
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"File name not specified\00"
@EXIT_FAILURE = global i32 0
@LC_ALL = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c".tmp\00"
@.str.3 = [7 x i8] c"malloc\00"
@.str.4 = [2 x i8] c"r\00"
@stderr = global i32* null
@.str.5 = [21 x i8] c"Can't open file: %s\0A\00"
@.str.6 = [3 x i8] c"w+\00"
@.str.8 = [9 x i8] c"mbstowcs\00"
@.str.9 = [8 x i8] c"realloc\00"
@.str.10 = [5 x i8] c"%ls\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = load i32, i32* @LC_ALL
%12 = tail call i32 @setlocale(i32 %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call dereferenceable_or_null(80) i8* @malloc(i32 80)
%15 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%16 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%17 = tail call i8* @malloc(i32 0)
%18 = icmp eq i8* %17, null
br i1 %18, label %21, label %19
19: ; preds = %10
%20 = zext i32 %0 to i64
br label %25
21: ; preds = %10
%22 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = tail call i32 @exit(i32 %23)
unreachable
25: ; preds = %19, %139
%26 = phi i64 [ 1, %19 ], [ %144, %139 ]
%27 = phi i8* [ %17, %19 ], [ %140, %139 ]
%28 = getelementptr inbounds i8*, i8** %1, i64 %26
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %38
32: ; preds = %25
%33 = load i32*, i32** @stderr
%34 = load i8*, i8** %28
%35 = call i32 @fprintf(i32* %33, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @EXIT_FAILURE
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %25
%39 = load i8*, i8** %28
%40 = call i32 @strlen(i8* %39)
%41 = add nsw i32 %40, %13
%42 = call i8* @malloc(i32 %41)
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %48
44: ; preds = %38
%45 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%46 = load i32, i32* @EXIT_FAILURE
%47 = call i32 @exit(i32 %46)
unreachable
48: ; preds = %38
%49 = load i8*, i8** %28
%50 = call i32 @strcpy(i8* %42, i8* %49)
%51 = call i32 @strcat(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%52 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%53 = call i32 @getline(i8** %3, i64* %4, i32* %30)
%54 = icmp eq i32 %53, -1
br i1 %54, label %139, label %55
55: ; preds = %48, %135
%56 = phi i32 [ %137, %135 ], [ %53, %48 ]
%57 = phi i8* [ %136, %135 ], [ %27, %48 ]
%58 = sext i32 %56 to i64
%59 = icmp ugt i32 %56, 80
br i1 %59, label %60, label %68
60: ; preds = %55
%61 = load i8*, i8** %3
%62 = call i64 @mbstowcs(i8* null, i8* %61, i64 0)
%63 = icmp eq i64 %62, -1
br i1 %63, label %64, label %68
64: ; preds = %60
%65 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %60, %55
%69 = phi i64 [ %62, %60 ], [ %58, %55 ]
%70 = icmp ugt i64 %69, 80
br i1 %70, label %71, label %132
71: ; preds = %68
%72 = call i8* @realloc(i8* %57, i64 %69)
%73 = icmp eq i8* %72, null
br i1 %73, label %74, label %78
74: ; preds = %71
%75 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%76 = load i32, i32* @EXIT_FAILURE
%77 = call i32 @exit(i32 %76)
unreachable
78: ; preds = %71
%79 = load i8*, i8** %3
%80 = call i64 @mbstowcs(i8* %72, i8* %79, i64 %69)
%81 = icmp eq i64 %80, -1
br i1 %81, label %84, label %82
82: ; preds = %78
%83 = add i64 %69, -1
br label %88
84: ; preds = %78
%85 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%86 = load i32, i32* @EXIT_FAILURE
%87 = call i32 @exit(i32 %86)
unreachable
88: ; preds = %82, %127
%89 = phi i64 [ %130, %127 ], [ 0, %82 ]
%90 = sub i64 %83, %89
%91 = icmp ugt i64 %90, 80
%92 = getelementptr inbounds i8, i8* %72, i64 %89
br i1 %91, label %93, label %124
93: ; preds = %88
%94 = call i32 @wcsncpy(i8* %14, i8* %92, i64 80)
br label %95
95: ; preds = %122, %93
%96 = phi i64 [ 79, %93 ], [ %123, %122 ]
%97 = getelementptr inbounds i8, i8* %14, i64 %96
%98 = load i8, i8* %97
%99 = icmp eq i8 %98, 32
br i1 %99, label %100, label %105
100: ; preds = %118, %110, %105, %95
%101 = phi i64 [ %96, %95 ], [ %106, %105 ], [ %111, %110 ], [ %116, %118 ]
%102 = getelementptr inbounds i8, i8* %14, i64 %101
store i8 0, i8* %102
%103 = add i64 %89, -79
%104 = add i64 %103, %101
br label %127
105: ; preds = %95
%106 = add nsw i64 %96, -1
%107 = getelementptr inbounds i8, i8* %14, i64 %106
%108 = load i8, i8* %107
%109 = icmp eq i8 %108, 32
br i1 %109, label %100, label %110
110: ; preds = %105
%111 = add nsw i64 %96, -2
%112 = getelementptr inbounds i8, i8* %14, i64 %111
%113 = load i8, i8* %112
%114 = icmp eq i8 %113, 32
br i1 %114, label %100, label %115
115: ; preds = %110
%116 = add nsw i64 %96, -3
%117 = icmp eq i64 %116, 0
br i1 %117, label %127, label %118
118: ; preds = %115
%119 = getelementptr inbounds i8, i8* %14, i64 %116
%120 = load i8, i8* %119
%121 = icmp eq i8 %120, 32
br i1 %121, label %100, label %122
122: ; preds = %118
%123 = add nsw i64 %96, -4
br label %95
124: ; preds = %88
%125 = call i32 @wcsncpy(i8* %14, i8* %92, i64 %90)
%126 = getelementptr inbounds i8, i8* %14, i64 %90
store i8 0, i8* %126
br label %127
127: ; preds = %115, %100, %124
%128 = phi i64 [ %104, %100 ], [ %89, %124 ], [ %89, %115 ]
%129 = call i32 @fprintf(i32* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* %14)
%130 = add i64 %128, 80
%131 = icmp ugt i64 %83, %130
br i1 %131, label %88, label %135
132: ; preds = %68
%133 = load i8*, i8** %3
%134 = call i32 @fputs(i8* %133, i32* %52)
br label %135
135: ; preds = %127, %132
%136 = phi i8* [ %57, %132 ], [ %72, %127 ]
%137 = call i32 @getline(i8** %3, i64* %4, i32* %30)
%138 = icmp eq i32 %137, -1
br i1 %138, label %139, label %55
139: ; preds = %135, %48
%140 = phi i8* [ %27, %48 ], [ %136, %135 ]
%141 = call i32 @fclose(i32* %30)
%142 = call i32 @fclose(i32* %52)
%143 = call i32 @free(i8* %42)
%144 = add nuw nsw i64 %26, 1
%145 = icmp eq i64 %144, %20
br i1 %145, label %146, label %25
146: ; preds = %139
%147 = call i32 @putchar(i32 10)
%148 = load i32, i32* @EXIT_SUCCESS
%149 = call i32 @exit(i32 %148)
unreachable
}