#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  int buf[10];
  int i;
  int c;
  int num;
  int linenum = 30000;
  int end = 0;
  FILE *fpin, *fpout;
  if (argc != 3) {
    printf("usage: %s infile outfile\n", argv[0]);
  }
  fpin = fopen(argv[1], "rb");
  fpout = fopen(argv[2], "wb");
  while (!end) {
    num = 0;
    for (i = 0; i < 10; i++) {
      c = fgetc(fpin);
      if (c == EOF) {
        end = 1;
        buf[num] = -1;
        num++;
        break;
      }
      buf[num] = c;
      num++;
    }
    fprintf(fpout, "%d DATA ", linenum);
    for (i = 0; i < num; i++) {
      if (i != 0) {
        fprintf(fpout, ", ");
      }
      fprintf(fpout, "%d", buf[i]);
    }
    fprintf(fpout, "%c", 155);
    linenum += 10;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x7530,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1181 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe75(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x68(%rbp)
cmpl   $0x0,-0x54(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11c7 <main+0x87>
jmp    12d1 <main+0x191>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    1240 <main+0x100>
mov    -0x60(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    0x2df3(%rip),%rcx
cmp    (%rcx),%eax
jne    121e <main+0xde>
movl   $0x1,-0x54(%rbp)
movslq -0x4c(%rbp),%rax
movl   $0xffffffff,-0x40(%rbp,%rax,4)
ff
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1240 <main+0x100>
mov    -0x48(%rbp),%ecx
movslq -0x4c(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11d5 <main+0x95>
mov    -0x68(%rbp),%rdi
mov    -0x50(%rbp),%edx
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    12ac <main+0x16c>
cmpl   $0x0,-0x44(%rbp)
je     1284 <main+0x144>
mov    -0x68(%rbp),%rdi
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x68(%rbp),%rdi
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xd95(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    125c <main+0x11c>
mov    -0x68(%rbp),%rdi
lea    0xd78(%rip),%rsi
mov    $0x9b,%edx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x50(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x50(%rbp)
jmp    11b1 <main+0x71>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1185 <main+0x25>
mov    (%rbx),%rsi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rdi
lea    0xe8a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
lea    0xe7a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    $0x7530,%r14d
mov    0x2e30(%rip),%rbp
lea    0xe6d(%rip),%r12
lea    0xe63(%rip),%r13
mov    %r15,0x40(%rsp)
jmp    11fa <main+0x9a>
nopl   (%rax)
mov    $0x9b,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
add    $0xa,%ebp
mov    %ebp,%r14d
cmpb   $0x0,0xc(%rsp)
mov    0x40(%rsp),%r15
mov    0x2df4(%rip),%rbp
je     13da <main+0x27a>
mov    %r15,%rdi
call   1040 <fgetc@plt>
cmp    0x0(%rbp),%eax
jne    1220 <main+0xc0>
xor    %r15d,%r15d
mov    %r14d,%ebp
jmp    1340 <main+0x1e0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,0x10(%rsp)
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %r15,%rdx
mov    $0x1,%r15d
cmp    0x0(%rbp),%eax
mov    %r14d,%ebp
je     1340 <main+0x1e0>
mov    %eax,0x14(%rsp)
mov    %rdx,%r14
mov    %rdx,%rdi
call   1040 <fgetc@plt>
mov    $0x2,%r15d
mov    0x2d8b(%rip),%rcx
cmp    (%rcx),%eax
je     1340 <main+0x1e0>
mov    %eax,0x18(%rsp)
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    $0x3,%r15d
mov    0x2d6a(%rip),%rcx
cmp    (%rcx),%eax
je     1340 <main+0x1e0>
mov    %eax,0x1c(%rsp)
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    $0x4,%r15d
mov    0x2d49(%rip),%rcx
cmp    (%rcx),%eax
je     1340 <main+0x1e0>
mov    %eax,0x20(%rsp)
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    $0x5,%r15d
mov    0x2d28(%rip),%rcx
cmp    (%rcx),%eax
je     1340 <main+0x1e0>
mov    %eax,0x24(%rsp)
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    $0x6,%r15d
mov    0x2d0b(%rip),%rcx
cmp    (%rcx),%eax
je     1340 <main+0x1e0>
mov    %eax,0x28(%rsp)
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    $0x7,%r15d
mov    0x2cee(%rip),%rcx
cmp    (%rcx),%eax
je     1340 <main+0x1e0>
mov    %eax,0x2c(%rsp)
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    $0x8,%r15d
mov    0x2cd1(%rip),%rcx
cmp    (%rcx),%eax
je     1340 <main+0x1e0>
mov    %eax,0x30(%rsp)
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    $0x9,%r15d
mov    0x2cb4(%rip),%rcx
cmp    (%rcx),%eax
jne    13c5 <main+0x265>
nopl   0x0(%rax)
movl   $0xffffffff,0x10(%rsp,%r15,4)
ff ff
add    $0x1,%r15
movl   $0x0,0xc(%rsp)
mov    %rbx,%rdi
lea    0xcc1(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
cmp    $0x1,%r15d
je     11d0 <main+0x70>
mov    $0x1,%r14d
nopl   0x0(%rax)
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbx,%rcx
call   1080 <fwrite@plt>
mov    0x10(%rsp,%r14,4),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    1390 <main+0x230>
jmp    11d0 <main+0x70>
mov    %eax,0x34(%rsp)
mov    $0xa,%r15d
mov    $0x1,%al
mov    %eax,0xc(%rsp)
jmp    1355 <main+0x1f5>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"usage: %s infile outfile\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [3 x i8] c"wb\00"
@EOF = global i32 0
@.str.3 = [9 x i8] c"%d DATA \00"
@.str.4 = [3 x i8] c", \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 30000, i32* %10
store i32 0, i32* %11
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %16, %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %12
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %29, i32** %13
br label %30
30: ; preds = %84, %21
%31 = load i32, i32* %11
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
br i1 %33, label %34, label %89
34: ; preds = %30
store i32 0, i32* %9
store i32 0, i32* %7
br label %35
35: ; preds = %57, %34
%36 = load i32, i32* %7
%37 = icmp slt i32 %36, 10
br i1 %37, label %38, label %60
38: ; preds = %35
%39 = load i32*, i32** %12
%40 = call i32 @fgetc(i32* %39)
store i32 %40, i32* %8
%41 = load i32, i32* %8
%42 = load i32, i32* @EOF
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %50
44: ; preds = %38
store i32 1, i32* %11
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %46
store i32 -1, i32* %47
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
br label %60
50: ; preds = %38
%51 = load i32, i32* %8
%52 = load i32, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %53
store i32 %51, i32* %54
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %57
57: ; preds = %50
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %35
60: ; preds = %44, %35
%61 = load i32*, i32** %13
%62 = load i32, i32* %10
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %62)
store i32 0, i32* %7
br label %64
64: ; preds = %81, %60
%65 = load i32, i32* %7
%66 = load i32, i32* %9
%67 = icmp slt i32 %65, %66
br i1 %67, label %68, label %84
68: ; preds = %64
%69 = load i32, i32* %7
%70 = icmp ne i32 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %68
%72 = load i32*, i32** %13
%73 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %74
74: ; preds = %71, %68
%75 = load i32*, i32** %13
%76 = load i32, i32* %7
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %77
%79 = load i32, i32* %78
%80 = call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %79)
br label %81
81: ; preds = %74
%82 = load i32, i32* %7
%83 = add nsw i32 %82, 1
store i32 %83, i32* %7
br label %64
84: ; preds = %64
%85 = load i32*, i32** %13
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 155)
%87 = load i32, i32* %10
%88 = add nsw i32 %87, 10
store i32 %88, i32* %10
br label %30
89: ; preds = %30
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"usage: %s infile outfile\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [3 x i8] c"wb\00"
@EOF = global i32 0
@.str.3 = [9 x i8] c"%d DATA \00"
@.str.4 = [3 x i8] c", \00"
@.str.5 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = icmp eq i32 %0, 3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
br label %27
27: ; preds = %9, %88
%28 = phi i32 [ 30000, %9 ], [ %90, %88 ]
%29 = tail call i32 @fgetc(i32* %12)
%30 = load i32, i32* @EOF
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %36
32: ; preds = %68, %64, %60, %56, %52, %48, %44, %40, %36, %27
%33 = phi i64 [ 0, %27 ], [ 1, %36 ], [ 2, %40 ], [ 3, %44 ], [ 4, %48 ], [ 5, %52 ], [ 6, %56 ], [ 7, %60 ], [ 8, %64 ], [ 9, %68 ]
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %33
store i32 -1, i32* %34
%35 = add nuw nsw i64 %33, 1
br label %73
36: ; preds = %27
store i32 %29, i32* %16
%37 = tail call i32 @fgetc(i32* %12)
%38 = load i32, i32* @EOF
%39 = icmp eq i32 %37, %38
br i1 %39, label %32, label %40
40: ; preds = %36
store i32 %37, i32* %17
%41 = tail call i32 @fgetc(i32* %12)
%42 = load i32, i32* @EOF
%43 = icmp eq i32 %41, %42
br i1 %43, label %32, label %44
44: ; preds = %40
store i32 %41, i32* %18
%45 = tail call i32 @fgetc(i32* %12)
%46 = load i32, i32* @EOF
%47 = icmp eq i32 %45, %46
br i1 %47, label %32, label %48
48: ; preds = %44
store i32 %45, i32* %19
%49 = tail call i32 @fgetc(i32* %12)
%50 = load i32, i32* @EOF
%51 = icmp eq i32 %49, %50
br i1 %51, label %32, label %52
52: ; preds = %48
store i32 %49, i32* %20
%53 = tail call i32 @fgetc(i32* %12)
%54 = load i32, i32* @EOF
%55 = icmp eq i32 %53, %54
br i1 %55, label %32, label %56
56: ; preds = %52
store i32 %53, i32* %21
%57 = tail call i32 @fgetc(i32* %12)
%58 = load i32, i32* @EOF
%59 = icmp eq i32 %57, %58
br i1 %59, label %32, label %60
60: ; preds = %56
store i32 %57, i32* %22
%61 = tail call i32 @fgetc(i32* %12)
%62 = load i32, i32* @EOF
%63 = icmp eq i32 %61, %62
br i1 %63, label %32, label %64
64: ; preds = %60
store i32 %61, i32* %23
%65 = tail call i32 @fgetc(i32* %12)
%66 = load i32, i32* @EOF
%67 = icmp eq i32 %65, %66
br i1 %67, label %32, label %68
68: ; preds = %64
store i32 %65, i32* %24
%69 = tail call i32 @fgetc(i32* %12)
%70 = load i32, i32* @EOF
%71 = icmp eq i32 %69, %70
br i1 %71, label %32, label %72
72: ; preds = %68
store i32 %69, i32* %25
br label %73
73: ; preds = %32, %72
%74 = phi i1 [ true, %72 ], [ false, %32 ]
%75 = phi i64 [ 10, %72 ], [ %35, %32 ]
%76 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%77 = load i32, i32* %26
%78 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %77)
%79 = icmp eq i64 %75, 1
br i1 %79, label %88, label %80
80: ; preds = %73, %80
%81 = phi i64 [ %86, %80 ], [ 1, %73 ]
%82 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 2, i64 1, i32* %15)
%83 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %81
%84 = load i32, i32* %83
%85 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %84)
%86 = add nuw nsw i64 %81, 1
%87 = icmp eq i64 %86, %75
br i1 %87, label %88, label %80
88: ; preds = %80, %73
%89 = tail call i32 @fputc(i32 155, i32* %15)
%90 = add nuw nsw i32 %28, 10
br i1 %74, label %27, label %91
91: ; preds = %88
ret i32 0
}