#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_two(int);
int /*<<< orphan*/ hexa_trad_two(char *);
int /*<<< orphan*/ last_line_two(int, char **, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ optimain_two(int);
scalar_t__ read(int, char *, int);
int size_files(int, char **);
int third_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_two(n2);
    hexa_trad_two(buf);
    n += 16;
    n2 += 16;
    if (size_files(i, av) % 16 != 0 && n == (size_files(i, av) / 16) * 16) {
      last_line_two(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_two(n2);
  }
  return (n2);
}


x86 assembly (clang, -O0):
<third_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   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1050 <read@plt>
cmp    $0x0,%rax
je     12e4 <third_part_of_main_two+0x164>
mov    -0x28(%rbp),%rax
movb   $0x0,0x10(%rax)
mov    -0x8(%rbp),%edi
call   10a0 <hexa_line_two@plt>
mov    -0x28(%rbp),%rdi
call   1060 <hexa_trad_two@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   1080 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1270 <third_part_of_main_two+0xf0>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1080 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
shl    $0x4,%ecx
cmp    %ecx,%eax
jne    1270 <third_part_of_main_two+0xf0>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1090 <last_line_two@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1080 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
jmp    12e4 <third_part_of_main_two+0x164>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1080 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12da <third_part_of_main_two+0x15a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1080 <size_files@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
shl    $0x4,%ecx
cmp    %ecx,%eax
jne    12da <third_part_of_main_two+0x15a>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    12da <third_part_of_main_two+0x15a>
mov    -0x8(%rbp),%edi
call   1030 <optimain_two@plt>
jmp    12df <third_part_of_main_two+0x15f>
jmp    11aa <third_part_of_main_two+0x2a>
mov    -0x8(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<third_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   1070 <malloc@plt>
mov    %rax,%rbp
mov    $0x10,%r14d
mov    %r13d,0x4(%rsp)
mov    %r13d,%edi
mov    %rax,%rsi
mov    $0x10,%edx
call   1050 <read@plt>
test   %rax,%rax
jne    11ee <third_part_of_main_two+0x6e>
jmp    12c2 <third_part_of_main_two+0x142>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1050 <read@plt>
add    $0x10,%r14d
test   %rax,%rax
je     127d <third_part_of_main_two+0xfd>
lea    (%r15,%r14,1),%r13d
lea    (%r15,%r14,1),%edi
add    $0xfffffff0,%edi
movb   $0x0,0x10(%rbp)
call   10a0 <hexa_line_two@plt>
mov    %rbp,%rdi
call   1060 <hexa_trad_two@plt>
mov    %ebx,%edi
mov    %r12,%rsi
call   1080 <size_files@plt>
test   $0xf,%al
je     1232 <third_part_of_main_two+0xb2>
mov    %ebx,%edi
mov    %r12,%rsi
call   1080 <size_files@plt>
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff0,%ecx
cmp    %ecx,%r14d
je     1286 <third_part_of_main_two+0x106>
mov    %ebx,%edi
mov    %r12,%rsi
call   1080 <size_files@plt>
test   $0xf,%al
jne    11d0 <third_part_of_main_two+0x50>
mov    %ebx,%edi
mov    %r12,%rsi
call   1080 <size_files@plt>
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff0,%ecx
cmp    %ecx,%r14d
jne    11d0 <third_part_of_main_two+0x50>
movslq %ebx,%rax
add    $0x1,%ebx
cmpq   $0x0,0x8(%r12,%rax,8)
jne    11d0 <third_part_of_main_two+0x50>
mov    %r13d,%edi
call   1030 <optimain_two@plt>
jmp    11d0 <third_part_of_main_two+0x50>
add    %r14d,%r15d
add    $0xfffffff0,%r15d
jmp    12c2 <third_part_of_main_two+0x142>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r13d,%edx
mov    0x4(%rsp),%ebp
mov    %ebp,%ecx
call   1090 <last_line_two@plt>
mov    %ebx,%edi
mov    %r12,%rsi
call   1080 <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   1040 <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 @third_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 = %82, %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 %83
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_two(i32 %21)
%23 = load i8*, i8** %10
%24 = call i32 @hexa_trad_two(i8* %23)
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 16
store i32 %26, i32* %9
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 16
store i32 %28, i32* %6
%29 = load i32, i32* %5
%30 = load i8**, i8*** %8
%31 = call i32 @size_files(i32 %29, i8** %30)
%32 = srem i32 %31, 16
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %56
34: ; preds = %18
%35 = load i32, i32* %9
%36 = load i32, i32* %5
%37 = load i8**, i8*** %8
%38 = call i32 @size_files(i32 %36, i8** %37)
%39 = sdiv i32 %38, 16
%40 = mul nsw i32 %39, 16
%41 = icmp eq i32 %35, %40
br i1 %41, label %42, label %56
42: ; preds = %34
%43 = load i32, i32* %5
%44 = load i8**, i8*** %8
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = call i32 @last_line_two(i32 %43, i8** %44, i32 %45, i32 %46)
%48 = load i32, i32* %5
%49 = load i8**, i8*** %8
%50 = call i32 @size_files(i32 %48, i8** %49)
%51 = srem i32 %50, 16
%52 = load i32, i32* %6
%53 = add nsw i32 %52, %51
store i32 %53, i32* %6
%54 = load i32, i32* %7
%55 = call i32 @close(i32 %54)
br label %83
56: ; preds = %34, %18
%57 = load i32, i32* %5
%58 = load i8**, i8*** %8
%59 = call i32 @size_files(i32 %57, i8** %58)
%60 = srem i32 %59, 16
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %81
62: ; preds = %56
%63 = load i32, i32* %9
%64 = load i32, i32* %5
%65 = load i8**, i8*** %8
%66 = call i32 @size_files(i32 %64, i8** %65)
%67 = sdiv i32 %66, 16
%68 = mul nsw i32 %67, 16
%69 = icmp eq i32 %63, %68
br i1 %69, label %70, label %81
70: ; preds = %62
%71 = load i8**, i8*** %8
%72 = load i32, i32* %5
%73 = add nsw i32 %72, 1
store i32 %73, i32* %5
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %71, i64 %74
%76 = load i8*, i8** %75
%77 = icmp ne i8* %76, null
br i1 %77, label %81, label %78
78: ; preds = %70
%79 = load i32, i32* %6
%80 = call i32 @optimain_two(i32 %79)
br label %81
81: ; preds = %78, %70, %62, %56
br label %82
82: ; preds = %81
br label %13
83: ; preds = %42, %13
%84 = load i32, i32* %6
ret i32 %84
}

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