#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 atoi(char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char **argv) {
  int start_num = atoi(argv[1]);
  char *fn = argv[2];
  FILE *infile;
  char str[100];
  int blah[4];
  char *sp, dig[6], new_dig[6];
  int first = 1, sub;
  dig[5] = new_dig[5] = '\0';
  infile = fopen(fn, "r");
  strcpy(dig, "00001");
  while (!feof(infile)) {
    fscanf(infile, "%s\n", str);
    if (!first) {
      if (strncmp(dig, str, 5) != 0)
        printf("\n");
      else
        printf("\t");
    } else
      first = 0;
    strncpy(dig, str, 5);
    sp = str;
    sp[3] = sp[3] + start_num;
    if (sp[3] > '9') {
      sp[3] -= 10;
      sp[2] += 1;
    }
    printf("%s ", str);
  };
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x1,-0xb8(%rbp)
movb   $0x0,-0xaf(%rbp)
movb   $0x0,-0xa9(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
lea    -0xae(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x28(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1212 <main+0x92>
jmp    1318 <main+0x198>
mov    -0x28(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xde4(%rip),%rsi
call   1070 <fscanf@plt>
cmpl   $0x0,-0xb8(%rbp)
jne    127e <main+0xfe>
lea    -0xae(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
je     126b <main+0xeb>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1279 <main+0xf9>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1288 <main+0x108>
movl   $0x0,-0xb8(%rbp)
lea    -0xae(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rax
movsbl 0x3(%rax),%eax
add    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0xa8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0xa8(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x39,%eax
jle    12fe <main+0x17e>
mov    -0xa8(%rbp),%rax
movsbl 0x3(%rax),%ecx
sub    $0xa,%ecx
mov    %cl,0x3(%rax)
mov    -0xa8(%rbp),%rax
movsbl 0x2(%rax),%ecx
add    $0x1,%ecx
mov    %cl,0x2(%rax)
lea    -0x90(%rbp),%rsi
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    11f4 <main+0x74>
lea    0xceb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r15d
mov    0x10(%rbx),%rdi
movb   $0x0,0xf(%rsp)
lea    0xe43(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
lea    0xe36(%rip),%rsi
lea    0xa(%rsp),%rdi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     11fd <main+0x6d>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe04(%rip),%r14
lea    0x10(%rsp),%rbp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
call   1080 <fscanf@plt>
lea    0xa(%rsp),%r12
lea    0xde9(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
mov    %rbp,%rsi
mov    $0x5,%edx
call   1040 <strncpy@plt>
movzbl 0x13(%rsp),%eax
add    %r15b,%al
mov    %al,0x13(%rsp)
cmp    $0x3a,%al
jl     125b <main+0xcb>
add    $0xf6,%al
mov    %al,0x13(%rsp)
addb   $0x1,0x12(%rsp)
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    11e2 <main+0x52>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
call   1080 <fscanf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    $0x5,%edx
call   1050 <strncmp@plt>
cmp    $0x1,%rax
mov    $0xa,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
jmp    1230 <main+0xa0>

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [6 x i8] c"00001\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.5 = [4 x i8] c"%s \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [6 x i8]
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 5
store i8 0, i8* %12
%13 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @feof(i32* %13)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %41
17: ; preds = %2
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 3
%19 = trunc i32 %7 to i8
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 2
%21 = call i32 @fscanf(i32* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %28
22: ; preds = %37
%23 = call i32 @fscanf(i32* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%24 = call i64 @strncmp(i8* %11, i8* %10, i32 5)
%25 = icmp eq i64 %24, 0
%26 = select i1 %25, i32 9, i32 10
%27 = call i32 @putchar(i32 %26)
br label %28
28: ; preds = %22, %17
%29 = call i32 @strncpy(i8* %11, i8* %10, i32 5)
%30 = load i8, i8* %18
%31 = add i8 %30, %19
store i8 %31, i8* %18
%32 = icmp sgt i8 %31, 57
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = add nsw i8 %31, -10
store i8 %34, i8* %18
%35 = load i8, i8* %20
%36 = add i8 %35, 1
store i8 %36, i8* %20
br label %37
37: ; preds = %33, %28
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%39 = call i32 @feof(i32* %13)
%40 = icmp eq i32 %39, 0
br i1 %40, label %22, label %41
41: ; preds = %37, %2
%42 = call i32 @putchar(i32 10)
ret i32 0
}