#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*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  FILE *input = fopen("123.txt", "rt");
  char line[10];
  char num[11];
  int nums[10];
  int i, j, k;
  char *ptr;
  fgets(line, 80, input);
  printf("%s\n", line);
  ptr = line;
  for (i = 0; i < 10; i++)
    nums[i] = 0;
  for (i = 0; i < 10; i++) {
    j = 0;
    for (k = 0; k < 11; k++)
      num[k] = '\0';
    while (*ptr != ' ' && j < 10) {
      num[j] = *ptr;
      j++;
      ptr++;
      printf("num now: %s\n", num);
    }
    printf("atoi(num) = %d\n", atoi(num));
    nums[i] = atoi(num);
    printf("nums[%d] = %d\n", i, nums[i]);
    if (*ptr != '\n')
      ptr = ptr + 1;
    j = 0;
  }
  for (i = 0; i < 10; i++)
    printf("%d, ", nums[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x50,%esi
call   1040 <fgets@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a(%rbp),%rax
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    11bd <main+0x7d>
movslq -0x54(%rbp),%rax
movl   $0x0,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1199 <main+0x59>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    12e1 <main+0x1a1>
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
cmpl   $0xb,-0x5c(%rbp)
jge    11fd <main+0xbd>
movslq -0x5c(%rbp),%rax
movb   $0x0,-0x25(%rbp,%rax,1)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    11dc <main+0x9c>
jmp    1202 <main+0xc2>
mov    -0x68(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x69(%rbp)
je     1221 <main+0xe1>
cmpl   $0xa,-0x58(%rbp)
setl   %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
test   $0x1,%al
jne    1231 <main+0xf1>
jmp    126b <main+0x12b>
mov    -0x68(%rbp),%rax
mov    (%rax),%cl
movslq -0x58(%rbp),%rax
mov    %cl,-0x25(%rbp,%rax,1)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
lea    -0x25(%rbp),%rsi
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1202 <main+0xc2>
lea    -0x25(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%esi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x25(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%esi
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x68(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     12cc <main+0x18c>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11c4 <main+0x84>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    1316 <main+0x1d6>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12e8 <main+0x1a8>
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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
lea    0xe8b(%rip),%rdi
lea    0xe8c(%rip),%rsi
call   1070 <fopen@plt>
lea    0x3e(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
mov    %rsp,%r14
lea    0xe5a(%rip),%r15
lea    0xe63(%rip),%r12
lea    0xe3f(%rip),%r13
xor    %ebp,%ebp
jmp    1224 <main+0xc4>
add    %r12,%rbx
lea    0xe3e(%rip),%r15
lea    0xe47(%rip),%r12
mov    %r14,%rdi
call   1080 <atoi@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1080 <atoi@plt>
mov    %eax,0x10(%rsp,%rbp,4)
mov    %r12,%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
cmpb   $0xa,(%rbx)
setne  %al
add    %rax,%rbx
add    $0x1,%rbp
cmp    $0xa,%rbp
je     1271 <main+0x111>
movl   $0x0,0x7(%rsp)
movq   $0x0,(%rsp)
mov    (%rbx),%al
cmp    $0x20,%al
je     11e1 <main+0x81>
xor    %r15d,%r15d
nopl   (%rax)
mov    %al,(%rsp,%r15,1)
lea    0x1(%r15),%r12
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1(%rbx,%r15,1),%eax
cmp    $0x20,%al
je     11d0 <main+0x70>
cmp    $0x9,%r15
mov    %r12,%r15
jb     1240 <main+0xe0>
jmp    11d0 <main+0x70>
mov    0x10(%rsp),%esi
lea    0xdbb(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"123.txt\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [13 x i8] c"num now: %s\0A\00"
@.str.4 = [16 x i8] c"atoi(num) = %d\0A\00"
@.str.5 = [15 x i8] c"nums[%d] = %d\0A\00"
@.str.6 = [5 x i8] c"%d, \00"
@.str.7 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [10 x i8]
%4 = alloca [11 x i8]
%5 = alloca [10 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %1
%10 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %2
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%12 = load i32*, i32** %2
%13 = call i32 @fgets(i8* %11, i32 80, i32* %12)
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
store i8* %16, i8** %9
store i32 0, i32* %6
br label %17
17: ; preds = %24, %0
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %22
store i32 0, i32* %23
br label %24
24: ; preds = %20
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %17
27: ; preds = %17
store i32 0, i32* %6
br label %28
28: ; preds = %88, %27
%29 = load i32, i32* %6
%30 = icmp slt i32 %29, 10
br i1 %30, label %31, label %91
31: ; preds = %28
store i32 0, i32* %7
store i32 0, i32* %8
br label %32
32: ; preds = %39, %31
%33 = load i32, i32* %8
%34 = icmp slt i32 %33, 11
br i1 %34, label %35, label %42
35: ; preds = %32
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 %37
store i8 0, i8* %38
br label %39
39: ; preds = %35
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
br label %32
42: ; preds = %32
br label %43
43: ; preds = %53, %42
%44 = load i8*, i8** %9
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %46, 32
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = load i32, i32* %7
%50 = icmp slt i32 %49, 10
br label %51
51: ; preds = %48, %43
%52 = phi i1 [ false, %43 ], [ %50, %48 ]
br i1 %52, label %53, label %65
53: ; preds = %51
%54 = load i8*, i8** %9
%55 = load i8, i8* %54
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 %57
store i8 %55, i8* %58
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
%61 = load i8*, i8** %9
%62 = getelementptr inbounds i8, i8* %61, i32 1
store i8* %62, i8** %9
%63 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %63)
br label %43
65: ; preds = %51
%66 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%67 = call i32 @atoi(i8* %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%70 = call i32 @atoi(i8* %69)
%71 = load i32, i32* %6
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %72
store i32 %70, i32* %73
%74 = load i32, i32* %6
%75 = load i32, i32* %6
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %76
%78 = load i32, i32* %77
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %74, i32 %78)
%80 = load i8*, i8** %9
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp ne i32 %82, 10
br i1 %83, label %84, label %87
84: ; preds = %65
%85 = load i8*, i8** %9
%86 = getelementptr inbounds i8, i8* %85, i64 1
store i8* %86, i8** %9
br label %87
87: ; preds = %84, %65
store i32 0, i32* %7
br label %88
88: ; preds = %87
%89 = load i32, i32* %6
%90 = add nsw i32 %89, 1
store i32 %90, i32* %6
br label %28
91: ; preds = %28
store i32 0, i32* %6
br label %92
92: ; preds = %101, %91
%93 = load i32, i32* %6
%94 = icmp slt i32 %93, 10
br i1 %94, label %95, label %104
95: ; preds = %92
%96 = load i32, i32* %6
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %97
%99 = load i32, i32* %98
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %99)
br label %101
101: ; preds = %95
%102 = load i32, i32* %6
%103 = add nsw i32 %102, 1
store i32 %103, i32* %6
br label %92
104: ; preds = %92
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"123.txt\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.3 = [13 x i8] c"num now: %s\0A\00"
@.str.4 = [16 x i8] c"atoi(num) = %d\0A\00"
@.str.5 = [15 x i8] c"nums[%d] = %d\0A\00"
@.str.6 = [5 x i8] c"%d, \00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%4 = alloca [10 x i32]
%5 = bitcast [10 x i32]* %4 to i8*
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%9 = call i32 @fgets(i8* %7, i32 80, i32* %6)
%10 = call i32 @puts(i8* %7)
br label %11
11: ; preds = %0, %28
%12 = phi i64 [ 0, %0 ], [ %40, %28 ]
%13 = phi i8* [ %7, %0 ], [ %39, %28 ]
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 32
br i1 %15, label %28, label %16
16: ; preds = %11, %16
%17 = phi i64 [ %21, %16 ], [ 0, %11 ]
%18 = phi i8 [ %24, %16 ], [ %14, %11 ]
%19 = phi i8* [ %22, %16 ], [ %13, %11 ]
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %17
store i8 %18, i8* %20
%21 = add nuw nsw i64 %17, 1
%22 = getelementptr inbounds i8, i8* %19, i64 1
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%24 = load i8, i8* %22
%25 = icmp ne i8 %24, 32
%26 = icmp ult i64 %17, 9
%27 = select i1 %25, i1 %26, i1 false
br i1 %27, label %16, label %28
28: ; preds = %16, %11
%29 = phi i8* [ %13, %11 ], [ %22, %16 ]
%30 = call i32 @atoi(i8* %8)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = call i32 @atoi(i8* %8)
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %12
store i32 %32, i32* %33
%34 = trunc i64 %12 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %34, i32 %32)
%36 = load i8, i8* %29
%37 = icmp ne i8 %36, 10
%38 = zext i1 %37 to i64
%39 = getelementptr i8, i8* %29, i64 %38
%40 = add nuw nsw i64 %12, 1
%41 = icmp eq i64 %40, 10
br i1 %41, label %42, label %11
42: ; preds = %28
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 1
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 2
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 3
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 4
%56 = load i32, i32* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 5
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 6
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 7
%65 = load i32, i32* %64
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 8
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %68)
%70 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 9
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %71)
%73 = call i32 @putchar(i32 10)
ret i32 0
}