#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*/ close(int);
int /*<<< orphan*/ hexa_line(int);
int /*<<< orphan*/ hexa_trad(char *);
int /*<<< orphan*/ last_line(int, char **, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ normal_line(char *);
int /*<<< orphan*/ optimain_one(int);
scalar_t__ read(int, char *, int);
int size_files(int, char **);
int second_part_of_main_two(int i, int n2, int fd, char **av) {
  int n;
  char *buf;
  n = 0;
  buf = (char *)malloc(sizeof(char) * 16 + 1);
  while (read(fd, buf, 16)) {
    buf[16] = '\0';
    hexa_line(n2);
    hexa_trad(buf);
    normal_line(buf);
    n += 16;
    n2 += 16;
    if (size_files(i, av) % 16 != 0 && n == (size_files(i, av) / 16) * 16) {
      last_line(i, av, n2, fd);
      n2 += (size_files(i, av) % 16);
      close(fd);
      break;
    } else if (size_files(i, av) % 16 == 0 &&
               n == (size_files(i, av) / 16 * 16) && !av[++i])
      optimain_one(n2);
  }
  return (n2);
}


x86 assembly (clang, -O0):
<second_part_of_main_two>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x11,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1060 <read@plt>
cmp    $0x0,%rax
je     12fd <second_part_of_main_two+0x16d>
mov    -0x28(%rbp),%rax
movb   $0x0,0x10(%rax)
mov    -0x8(%rbp),%edi
call   1070 <hexa_line@plt>
mov    -0x28(%rbp),%rdi
call   1040 <hexa_trad@plt>
mov    -0x28(%rbp),%rdi
call   10a0 <normal_line@plt>
mov    -0x1c(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1090 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1289 <second_part_of_main_two+0xf9>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1090 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
shl    $0x4,%ecx
cmp    %ecx,%eax
jne    1289 <second_part_of_main_two+0xf9>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1030 <last_line@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1090 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <close@plt>
jmp    12fd <second_part_of_main_two+0x16d>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1090 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12f3 <second_part_of_main_two+0x163>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1090 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
shl    $0x4,%ecx
cmp    %ecx,%eax
jne    12f3 <second_part_of_main_two+0x163>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    12f3 <second_part_of_main_two+0x163>
mov    -0x8(%rbp),%edi
call   10b0 <optimain_one@plt>
jmp    12f8 <second_part_of_main_two+0x168>
jmp    11ba <second_part_of_main_two+0x2a>
mov    -0x8(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<second_part_of_main_two>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r12
mov    %edx,%r13d
mov    %esi,%r15d
mov    %edi,%ebx
mov    $0x11,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
mov    $0x10,%r14d
mov    %r13d,0x4(%rsp)
mov    %r13d,%edi
mov    %rax,%rsi
mov    $0x10,%edx
call   1060 <read@plt>
test   %rax,%rax
jne    11fe <second_part_of_main_two+0x6e>
jmp    12da <second_part_of_main_two+0x14a>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <read@plt>
add    $0x10,%r14d
test   %rax,%rax
je     1295 <second_part_of_main_two+0x105>
lea    (%r15,%r14,1),%r13d
lea    (%r15,%r14,1),%edi
add    $0xfffffff0,%edi
movb   $0x0,0x10(%rbp)
call   1070 <hexa_line@plt>
mov    %rbp,%rdi
call   1040 <hexa_trad@plt>
mov    %rbp,%rdi
call   10a0 <normal_line@plt>
mov    %ebx,%edi
mov    %r12,%rsi
call   1090 <size_files@plt>
test   $0xf,%al
je     124a <second_part_of_main_two+0xba>
mov    %ebx,%edi
mov    %r12,%rsi
call   1090 <size_files@plt>
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff0,%ecx
cmp    %ecx,%r14d
je     129e <second_part_of_main_two+0x10e>
mov    %ebx,%edi
mov    %r12,%rsi
call   1090 <size_files@plt>
test   $0xf,%al
jne    11e0 <second_part_of_main_two+0x50>
mov    %ebx,%edi
mov    %r12,%rsi
call   1090 <size_files@plt>
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff0,%ecx
cmp    %ecx,%r14d
jne    11e0 <second_part_of_main_two+0x50>
movslq %ebx,%rax
add    $0x1,%ebx
cmpq   $0x0,0x8(%r12,%rax,8)
jne    11e0 <second_part_of_main_two+0x50>
mov    %r13d,%edi
call   10b0 <optimain_one@plt>
jmp    11e0 <second_part_of_main_two+0x50>
add    %r14d,%r15d
add    $0xfffffff0,%r15d
jmp    12da <second_part_of_main_two+0x14a>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r13d,%edx
mov    0x4(%rsp),%ebp
mov    %ebp,%ecx
call   1030 <last_line@plt>
mov    %ebx,%edi
mov    %r12,%rsi
call   1090 <size_files@plt>
mov    %eax,%ebx
lea    0xf(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff0,%eax
sub    %eax,%ebx
add    %r15d,%ebx
add    %r14d,%ebx
mov    %ebp,%edi
call   1050 <close@plt>
mov    %ebx,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @second_part_of_main_two(i32 %0, i32 %1, i32 %2, i8** %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8** %3, i8*** %8
store i32 0, i32* %9
%11 = call i64 @malloc(i32 17)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %10
br label %13
13: ; preds = %84, %4
%14 = load i32, i32* %7
%15 = load i8*, i8** %10
%16 = call i64 @read(i32 %14, i8* %15, i32 16)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %85
18: ; preds = %13
%19 = load i8*, i8** %10
%20 = getelementptr inbounds i8, i8* %19, i64 16
store i8 0, i8* %20
%21 = load i32, i32* %6
%22 = call i32 @hexa_line(i32 %21)
%23 = load i8*, i8** %10
%24 = call i32 @hexa_trad(i8* %23)
%25 = load i8*, i8** %10
%26 = call i32 @normal_line(i8* %25)
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 16
store i32 %28, i32* %9
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 16
store i32 %30, i32* %6
%31 = load i32, i32* %5
%32 = load i8**, i8*** %8
%33 = call i32 @size_files(i32 %31, i8** %32)
%34 = srem i32 %33, 16
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %58
36: ; preds = %18
%37 = load i32, i32* %9
%38 = load i32, i32* %5
%39 = load i8**, i8*** %8
%40 = call i32 @size_files(i32 %38, i8** %39)
%41 = sdiv i32 %40, 16
%42 = mul nsw i32 %41, 16
%43 = icmp eq i32 %37, %42
br i1 %43, label %44, label %58
44: ; preds = %36
%45 = load i32, i32* %5
%46 = load i8**, i8*** %8
%47 = load i32, i32* %6
%48 = load i32, i32* %7
%49 = call i32 @last_line(i32 %45, i8** %46, i32 %47, i32 %48)
%50 = load i32, i32* %5
%51 = load i8**, i8*** %8
%52 = call i32 @size_files(i32 %50, i8** %51)
%53 = srem i32 %52, 16
%54 = load i32, i32* %6
%55 = add nsw i32 %54, %53
store i32 %55, i32* %6
%56 = load i32, i32* %7
%57 = call i32 @close(i32 %56)
br label %85
58: ; preds = %36, %18
%59 = load i32, i32* %5
%60 = load i8**, i8*** %8
%61 = call i32 @size_files(i32 %59, i8** %60)
%62 = srem i32 %61, 16
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %83
64: ; preds = %58
%65 = load i32, i32* %9
%66 = load i32, i32* %5
%67 = load i8**, i8*** %8
%68 = call i32 @size_files(i32 %66, i8** %67)
%69 = sdiv i32 %68, 16
%70 = mul nsw i32 %69, 16
%71 = icmp eq i32 %65, %70
br i1 %71, label %72, label %83
72: ; preds = %64
%73 = load i8**, i8*** %8
%74 = load i32, i32* %5
%75 = add nsw i32 %74, 1
store i32 %75, i32* %5
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8*, i8** %73, i64 %76
%78 = load i8*, i8** %77
%79 = icmp ne i8* %78, null
br i1 %79, label %83, label %80
80: ; preds = %72
%81 = load i32, i32* %6
%82 = call i32 @optimain_one(i32 %81)
br label %83
83: ; preds = %80, %72, %64, %58
br label %84
84: ; preds = %83
br label %13
85: ; preds = %44, %13
%86 = load i32, i32* %6
ret i32 %86
}

LLVM IR (-O2):
define i32 @second_part_of_main_two(i32 %0, i32 %1, i32 %2, i8** %3) {
%5 = tail call i64 @malloc(i32 17)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i64 @read(i32 %2, i8* %6, i32 16)
%8 = icmp eq i64 %7, 0
br i1 %8, label %55, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 16
br label %11
11: ; preds = %9, %51
%12 = phi i32 [ %0, %9 ], [ %52, %51 ]
%13 = phi i32 [ 0, %9 ], [ %18, %51 ]
%14 = phi i32 [ %1, %9 ], [ %19, %51 ]
store i8 0, i8* %10
%15 = tail call i32 @hexa_line(i32 %14)
%16 = tail call i32 @hexa_trad(i8* %6)
%17 = tail call i32 @normal_line(i8* %6)
%18 = add nuw nsw i32 %13, 16
%19 = add nsw i32 %14, 16
%20 = tail call i32 @size_files(i32 %12, i8** %3)
%21 = and i32 %20, 15
%22 = icmp eq i32 %21, 0
br i1 %22, label %34, label %23
23: ; preds = %11
%24 = tail call i32 @size_files(i32 %12, i8** %3)
%25 = sdiv i32 %24, 16
%26 = shl nsw i32 %25, 4
%27 = icmp eq i32 %18, %26
br i1 %27, label %28, label %34
28: ; preds = %23
%29 = tail call i32 @last_line(i32 %12, i8** %3, i32 %19, i32 %2)
%30 = tail call i32 @size_files(i32 %12, i8** %3)
%31 = srem i32 %30, 16
%32 = add nsw i32 %31, %19
%33 = tail call i32 @close(i32 %2)
br label %55
34: ; preds = %23, %11
%35 = tail call i32 @size_files(i32 %12, i8** %3)
%36 = and i32 %35, 15
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %51
38: ; preds = %34
%39 = tail call i32 @size_files(i32 %12, i8** %3)
%40 = sdiv i32 %39, 16
%41 = shl nsw i32 %40, 4
%42 = icmp eq i32 %18, %41
br i1 %42, label %43, label %51
43: ; preds = %38
%44 = add nsw i32 %12, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %3, i64 %45
%47 = load i8*, i8** %46
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = tail call i32 @optimain_one(i32 %19)
br label %51
51: ; preds = %34, %38, %43, %49
%52 = phi i32 [ %44, %43 ], [ %44, %49 ], [ %12, %38 ], [ %12, %34 ]
%53 = tail call i64 @read(i32 %2, i8* %6, i32 16)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %11
55: ; preds = %51, %4, %28
%56 = phi i32 [ %32, %28 ], [ %1, %4 ], [ %19, %51 ]
ret i32 %56
}