#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 IFNAMSIZ;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned short, ...);
scalar_t__ read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ usage();
int write(int, char *, int);
int main(int argc, char **argv) {
  char ifname[IFNAMSIZ];
  int ret;
  char ibuf[2000], obuf[6000];
  int fd, i;
  unsigned short pktlen;
  unsigned long tstamp;
  int olen;
  if (argc != 2 || (strlen(argv[1]) >= IFNAMSIZ)) {
    usage();
    return 2;
  }
  strcpy(ifname, argv[1]);
  fd = open("/dev/mgcap/lo", O_RDONLY);
  if (fd < 0) {
    fprintf(stderr, "cannot open mgcap device\n");
    return 1;
  }
  while (1) {
    if (read(fd, ibuf, (128)) <= 0)
      continue;
    pktlen = *(unsigned short *)&ibuf[0];
    tstamp = *(unsigned long *)&ibuf[2];
    printf("pktlen=%u, tstamp=%lu\n", pktlen, tstamp);
    if ((pktlen < 40) || (pktlen > 9014)) {
      printf("format size: pktlen %X\n", pktlen);
      return 1;
    }
    sprintf(obuf, "%02X%02X%02X%02X%02X%02X %02X%02X%02X%02X%02X%02X %02X%02X",
            ibuf[10], ibuf[11], ibuf[12], ibuf[13], ibuf[14], ibuf[15],
            ibuf[16], ibuf[17], ibuf[18], ibuf[19], ibuf[20], ibuf[21],
            ibuf[22], ibuf[23]);
    olen = strlen(obuf);
    for (i = (14) + 10; i < pktlen; i++) {
      sprintf(obuf + olen + ((i - ((14) + 10)) * 3), " %02X", ibuf[i]);
    }
    strcat(obuf, "\n");
    ret = write(1, obuf, strlen(obuf));
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1fa8,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    0x2e07(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1fb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
cmpl   $0x2,-0x30(%rbp)
jne    1217 <main+0x77>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strlen@plt>
mov    0x2dc1(%rip),%rcx
cmp    (%rcx),%eax
jl     1234 <main+0x94>
mov    $0x0,%al
call   1090 <usage@plt>
movl   $0x2,-0x2c(%rbp)
movl   $0x1,-0x1fb0(%rbp)
jmp    14ed <main+0x34d>
mov    -0x1fb8(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    0x2d99(%rip),%rax
mov    (%rax),%esi
lea    0xda8(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x1f94(%rbp)
cmpl   $0x0,-0x1f94(%rbp)
jge    129b <main+0xfb>
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
lea    0xd8e(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0x1,-0x2c(%rbp)
movl   $0x1,-0x1fb0(%rbp)
jmp    14ed <main+0x34d>
jmp    12a0 <main+0x100>
jmp    12a5 <main+0x105>
mov    -0x1f94(%rbp),%edi
lea    -0x820(%rbp),%rsi
mov    $0x80,%edx
call   1070 <read@plt>
cmp    $0x0,%rax
jg     12cb <main+0x12b>
jmp    12a0 <main+0x100>
mov    -0x820(%rbp),%ax
mov    %ax,-0x1f9a(%rbp)
mov    -0x81e(%rbp),%rax
mov    %rax,-0x1fa8(%rbp)
mov    -0x1f9a(%rbp),%ax
mov    -0x1fa8(%rbp),%rdx
lea    0xd2c(%rip),%rdi
movzwl %ax,%esi
mov    $0x0,%al
call   1060 <printf@plt>
movzwl -0x1f9a(%rbp),%eax
cmp    $0x28,%eax
jl     1328 <main+0x188>
movzwl -0x1f9a(%rbp),%eax
cmp    $0x2336,%eax
jle    1353 <main+0x1b3>
lea    0xd10(%rip),%rdi
movzwl -0x1f9a(%rbp),%esi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x2c(%rbp)
movl   $0x1,-0x1fb0(%rbp)
jmp    14ed <main+0x34d>
lea    -0x1f90(%rbp),%rdi
mov    -0x816(%rbp),%dl
movsbl -0x815(%rbp),%ecx
movsbl -0x814(%rbp),%r8d
ff
movsbl -0x813(%rbp),%r9d
ff
movsbl -0x812(%rbp),%eax
movsbl -0x811(%rbp),%esi
mov    %esi,-0x1fc0(%rbp)
movsbl -0x810(%rbp),%r13d
ff
movsbl -0x80f(%rbp),%r12d
ff
movsbl -0x80e(%rbp),%r15d
ff
movsbl -0x80d(%rbp),%r14d
ff
movsbl -0x80c(%rbp),%ebx
movsbl -0x80b(%rbp),%r11d
ff
movsbl -0x80a(%rbp),%r10d
ff
movsbl -0x809(%rbp),%esi
mov    %esi,-0x1fbc(%rbp)
lea    0xc81(%rip),%rsi
sub    $0x50,%rsp
movsbl %dl,%edx
mov    %eax,(%rsp)
mov    -0x1fc0(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x1fbc(%rbp),%eax
mov    %r13d,0x10(%rsp)
mov    %r12d,0x18(%rsp)
mov    %r15d,0x20(%rsp)
mov    %r14d,0x28(%rsp)
mov    %ebx,0x30(%rsp)
mov    %r11d,0x38(%rsp)
mov    %r10d,0x40(%rsp)
mov    %eax,0x48(%rsp)
mov    $0x0,%al
call   10c0 <sprintf@plt>
add    $0x50,%rsp
lea    -0x1f90(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x1fac(%rbp)
movl   $0x18,-0x1f98(%rbp)
mov    -0x1f98(%rbp),%eax
movzwl -0x1f9a(%rbp),%ecx
cmp    %ecx,%eax
jge    14a5 <main+0x305>
lea    -0x1f90(%rbp),%rdi
movslq -0x1fac(%rbp),%rax
add    %rax,%rdi
mov    -0x1f98(%rbp),%eax
sub    $0x18,%eax
imul   $0x3,%eax,%eax
cltq
add    %rax,%rdi
movslq -0x1f98(%rbp),%rax
lea    0xc10(%rip),%rsi
movsbl -0x820(%rbp,%rax,1),%edx
ff
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x1f98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f98(%rbp)
jmp    143d <main+0x29d>
lea    -0x1f90(%rbp),%rdi
lea    0xba2(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x1f90(%rbp),%rax
mov    %rax,-0x1fc8(%rbp)
lea    -0x1f90(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x1fc8(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <write@plt>
mov    %eax,-0x4c(%rbp)
jmp    12a0 <main+0x100>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x2c(%rbp),%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f78,%rsp
mov    0x2e15(%rip),%r15
mov    (%r15),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x2,%edi
jne    1394 <main+0x1f4>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1050 <strlen@plt>
cmp    (%r15),%eax
jge    1394 <main+0x1f4>
mov    0x8(%r14),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    0x2de8(%rip),%rax
mov    (%rax),%esi
lea    0xdf7(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
js     13b5 <main+0x215>
lea    0xe72(%rip),%r12
mov    -0x2c(%rbp),%edi
lea    -0x830(%rbp),%rsi
mov    $0x80,%edx
call   1070 <read@plt>
test   %rax,%rax
jle    1220 <main+0x80>
movzwl -0x830(%rbp),%r15d
ff
mov    -0x82e(%rbp),%rdx
lea    0xdd9(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15d,%eax
add    $0xffffdcc9,%eax
movzwl %ax,%eax
cmp    $0xdcf0,%eax
jbe    13a2 <main+0x202>
movsbl -0x826(%rbp),%edx
movsbl -0x825(%rbp),%ecx
movsbl -0x824(%rbp),%r8d
ff
movsbl -0x823(%rbp),%r9d
ff
movsbl -0x822(%rbp),%eax
mov    %rax,-0x58(%rbp)
movsbl -0x821(%rbp),%eax
mov    %rax,-0x50(%rbp)
movsbl -0x820(%rbp),%eax
mov    %rax,-0x48(%rbp)
movsbl -0x81f(%rbp),%eax
mov    %rax,-0x40(%rbp)
movsbl -0x81e(%rbp),%eax
mov    %rax,-0x38(%rbp)
movsbl -0x81d(%rbp),%r10d
ff
movsbl -0x81c(%rbp),%r11d
ff
movsbl -0x81b(%rbp),%r14d
ff
movsbl -0x81a(%rbp),%ebx
movsbl -0x819(%rbp),%r13d
ff
lea    -0x1fa0(%rbp),%rdi
lea    0xd5e(%rip),%rsi
xor    %eax,%eax
push   %r13
push   %rbx
push   %r14
push   %r11
push   %r10
push   -0x38(%rbp)
push   -0x40(%rbp)
push   -0x48(%rbp)
push   -0x50(%rbp)
push   -0x58(%rbp)
call   10c0 <sprintf@plt>
add    $0x50,%rsp
lea    -0x1fa0(%rbp),%rdi
call   1050 <strlen@plt>
cltq
lea    (%rax,%rbp,1),%r14
add    $0xffffffffffffe060,%r14
mov    $0x18,%ebx
nopw   0x0(%rax,%rax,1)
movsbl -0x830(%rbp,%rbx,1),%edx
ff
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10c0 <sprintf@plt>
add    $0x1,%rbx
add    $0x3,%r14
cmp    %rbx,%r15
jne    1340 <main+0x1a0>
lea    -0x1fa0(%rbp),%rbx
mov    %rbx,%rdi
lea    0xce2(%rip),%rsi
call   10b0 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
jmp    1220 <main+0x80>
xor    %eax,%eax
call   1090 <usage@plt>
mov    $0x2,%eax
jmp    13cf <main+0x22f>
lea    0xc96(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13ca <main+0x22a>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xc49(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@IFNAMSIZ = global i32 0
@.str = [14 x i8] c"/dev/mgcap/lo\00"
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str.1 = [26 x i8] c"cannot open mgcap device\0A\00"
@.str.2 = [23 x i8] c"pktlen=%u, tstamp=%lu\0A\00"
@.str.3 = [24 x i8] c"format size: pktlen %X\0A\00"
@.str.4 = [59 x i8] c"%02X%02X%02X%02X%02X%02X %02X%02X%02X%02X%02X%02X %02X%02X\00"
@.str.5 = [6 x i8] c" %02X\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca [2000 x i8]
%10 = alloca [6000 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i16
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* @IFNAMSIZ
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %6
%20 = alloca i8, i64 %18
store i64 %18, i64* %7
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 2
br i1 %22, label %30, label %23
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @strlen(i8* %26)
%28 = load i32, i32* @IFNAMSIZ
%29 = icmp sge i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %23, %2
%31 = call i32 (...) @usage()
store i32 2, i32* %3
store i32 1, i32* %16
br label %148
32: ; preds = %23
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @strcpy(i8* %20, i8* %35)
%37 = load i32, i32* @O_RDONLY
%38 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %37)
store i32 %38, i32* %11
%39 = load i32, i32* %11
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %32
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %16
br label %148
44: ; preds = %32
br label %45
45: ; preds = %141, %51, %44
br label %46
46: ; preds = %45
%47 = load i32, i32* %11
%48 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%49 = call i64 @read(i32 %47, i8* %48, i32 128)
%50 = icmp sle i64 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %46
br label %45
52: ; preds = %46
%53 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%54 = bitcast i8* %53 to i16*
%55 = load i16, i16* %54
store i16 %55, i16* %13
%56 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 2
%57 = bitcast i8* %56 to i64*
%58 = load i64, i64* %57
store i64 %58, i64* %14
%59 = load i16, i16* %13
%60 = load i64, i64* %14
%61 = call i32 (i8*, i16, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i16 zeroext %59, i64 %60)
%62 = load i16, i16* %13
%63 = zext i16 %62 to i32
%64 = icmp slt i32 %63, 40
br i1 %64, label %69, label %65
65: ; preds = %52
%66 = load i16, i16* %13
%67 = zext i16 %66 to i32
%68 = icmp sgt i32 %67, 9014
br i1 %68, label %69, label %72
69: ; preds = %65, %52
%70 = load i16, i16* %13
%71 = call i32 (i8*, i16, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %70)
store i32 1, i32* %3
store i32 1, i32* %16
br label %148
72: ; preds = %65
%73 = getelementptr inbounds [6000 x i8], [6000 x i8]* %10, i64 0, i64 0
%74 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 10
%75 = load i8, i8* %74
%76 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 11
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 12
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 13
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 14
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 15
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 16
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 17
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 18
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 19
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 20
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 21
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 22
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 23
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = call i32 (i8*, i8*, i8, ...) @sprintf(i8* %73, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i8 signext %75, i32 %78, i32 %81, i32 %84, i32 %87, i32 %90, i32 %93, i32 %96, i32 %99, i32 %102, i32 %105, i32 %108, i32 %111, i32 %114)
%116 = getelementptr inbounds [6000 x i8], [6000 x i8]* %10, i64 0, i64 0
%117 = call i32 @strlen(i8* %116)
store i32 %117, i32* %15
store i32 24, i32* %12
br label %118
118: ; preds = %138, %72
%119 = load i32, i32* %12
%120 = load i16, i16* %13
%121 = zext i16 %120 to i32
%122 = icmp slt i32 %119, %121
br i1 %122, label %123, label %141
123: ; preds = %118
%124 = getelementptr inbounds [6000 x i8], [6000 x i8]* %10, i64 0, i64 0
%125 = load i32, i32* %15
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8, i8* %124, i64 %126
%128 = load i32, i32* %12
%129 = sub nsw i32 %128, 24
%130 = mul nsw i32 %129, 3
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %127, i64 %131
%133 = load i32, i32* %12
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 %134
%136 = load i8, i8* %135
%137 = call i32 (i8*, i8*, i8, ...) @sprintf(i8* %132, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8 signext %136)
br label %138
138: ; preds = %123
%139 = load i32, i32* %12
%140 = add nsw i32 %139, 1
store i32 %140, i32* %12
br label %118
141: ; preds = %118
%142 = getelementptr inbounds [6000 x i8], [6000 x i8]* %10, i64 0, i64 0
%143 = call i32 @strcat(i8* %142, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%144 = getelementptr inbounds [6000 x i8], [6000 x i8]* %10, i64 0, i64 0
%145 = getelementptr inbounds [6000 x i8], [6000 x i8]* %10, i64 0, i64 0
%146 = call i32 @strlen(i8* %145)
%147 = call i32 @write(i32 1, i8* %144, i32 %146)
store i32 %147, i32* %8
br label %45
148: ; preds = %69, %41, %30
%149 = load i8*, i8** %6
%150 = load i32, i32* %3
ret i32 %150
}

LLVM IR (-O2):
@IFNAMSIZ = global i32 0
@.str = [14 x i8] c"/dev/mgcap/lo\00"
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str.1 = [26 x i8] c"cannot open mgcap device\0A\00"
@.str.2 = [23 x i8] c"pktlen=%u, tstamp=%lu\0A\00"
@.str.3 = [24 x i8] c"format size: pktlen %X\0A\00"
@.str.4 = [59 x i8] c"%02X%02X%02X%02X%02X%02X %02X%02X%02X%02X%02X%02X %02X%02X\00"
@.str.5 = [6 x i8] c" %02X\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2000 x i8]
%4 = alloca [6000 x i8]
%5 = load i32, i32* @IFNAMSIZ
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [6000 x i8], [6000 x i8]* %4, i64 0, i64 0
%10 = icmp eq i32 %0, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strlen(i8* %13)
%15 = load i32, i32* @IFNAMSIZ
%16 = icmp slt i32 %14, %15
br i1 %16, label %19, label %17
17: ; preds = %11, %2
%18 = tail call i32 (...) @usage()
br label %105
19: ; preds = %11
%20 = load i8*, i8** %12
%21 = call i32 @strcpy(i8* %7, i8* %20)
%22 = load i32, i32* @O_RDONLY
%23 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = icmp slt i32 %23, 0
br i1 %24, label %43, label %25
25: ; preds = %19
%26 = bitcast [2000 x i8]* %3 to i16*
%27 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 2
%28 = bitcast i8* %27 to i64*
%29 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 10
%30 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 11
%31 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 12
%32 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 13
%33 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 14
%34 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 15
%35 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 16
%36 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 17
%37 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 18
%38 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 19
%39 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 20
%40 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 21
%41 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 22
%42 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 23
br label %46
43: ; preds = %19
%44 = load i32, i32* @stderr
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %105
46: ; preds = %104, %25
%47 = call i64 @read(i32 %23, i8* %8, i32 128)
%48 = icmp slt i64 %47, 1
br i1 %48, label %104, label %49
49: ; preds = %46
%50 = load i16, i16* %26
%51 = load i64, i64* %28
%52 = call i32 (i8*, i16, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i16 zeroext %50, i64 %51)
%53 = add i16 %50, -9015
%54 = icmp ult i16 %53, -8975
br i1 %54, label %55, label %57
55: ; preds = %49
%56 = call i32 (i8*, i16, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %50)
br label %105
57: ; preds = %49
%58 = load i8, i8* %29
%59 = load i8, i8* %30
%60 = sext i8 %59 to i32
%61 = load i8, i8* %31
%62 = sext i8 %61 to i32
%63 = load i8, i8* %32
%64 = sext i8 %63 to i32
%65 = load i8, i8* %33
%66 = sext i8 %65 to i32
%67 = load i8, i8* %34
%68 = sext i8 %67 to i32
%69 = load i8, i8* %35
%70 = sext i8 %69 to i32
%71 = load i8, i8* %36
%72 = sext i8 %71 to i32
%73 = load i8, i8* %37
%74 = sext i8 %73 to i32
%75 = load i8, i8* %38
%76 = sext i8 %75 to i32
%77 = load i8, i8* %39
%78 = sext i8 %77 to i32
%79 = load i8, i8* %40
%80 = sext i8 %79 to i32
%81 = load i8, i8* %41
%82 = sext i8 %81 to i32
%83 = load i8, i8* %42
%84 = sext i8 %83 to i32
%85 = call i32 (i8*, i8*, i8, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i8 signext %58, i32 %60, i32 %62, i32 %64, i32 %66, i32 %68, i32 %70, i32 %72, i32 %74, i32 %76, i32 %78, i32 %80, i32 %82, i32 %84)
%86 = call i32 @strlen(i8* %9)
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [6000 x i8], [6000 x i8]* %4, i64 0, i64 %87
%89 = zext i16 %50 to i64
br label %90
90: ; preds = %57, %90
%91 = phi i64 [ 24, %57 ], [ %98, %90 ]
%92 = mul nuw nsw i64 %91, 3
%93 = add nsw i64 %92, -72
%94 = getelementptr inbounds i8, i8* %88, i64 %93
%95 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 %91
%96 = load i8, i8* %95
%97 = call i32 (i8*, i8*, i8, ...) @sprintf(i8* %94, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8 signext %96)
%98 = add nuw nsw i64 %91, 1
%99 = icmp eq i64 %98, %89
br i1 %99, label %100, label %90
100: ; preds = %90
%101 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%102 = call i32 @strlen(i8* %9)
%103 = call i32 @write(i32 1, i8* %9, i32 %102)
br label %104
104: ; preds = %100, %46
br label %46
105: ; preds = %55, %43, %17
%106 = phi i32 [ 2, %17 ], [ 1, %43 ], [ 1, %55 ]
ret i32 %106
}