#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 /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
void parse_problem(FILE *in_file, int *arr, int *size) {
  for (int i = 0; i < (*size - 1); i++)
    fscanf(in_file, "%d,", &arr[i]);
  fscanf(in_file, "%d\n", &arr[*size - 1]);
}


x86 assembly (clang, -O0):
<parse_problem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    116c <parse_problem+0x5c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xea7(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <parse_problem+0x1b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe77(%rip),%rsi
call   1030 <fscanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_problem>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
movslq (%rdx),%rax
cmp    $0x2,%rax
jl     1165 <parse_problem+0x55>
mov    %rdx,%r13
xor    %ebp,%ebp
lea    0xeca(%rip),%r12
mov    %r14,%rbx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1030 <fscanf@plt>
add    $0x1,%rbp
movslq 0x0(%r13),%rax
add    $0xffffffffffffffff,%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     1140 <parse_problem+0x30>
jmp    1169 <parse_problem+0x59>
add    $0xffffffffffffffff,%rax
lea    (%r14,%rax,4),%rdx
lea    0xe90(%rip),%rsi
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fscanf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d,\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @parse_problem(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
br label %8
8: ; preds = %21, %3
%9 = load i32, i32* %7
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = sub nsw i32 %11, 1
%13 = icmp slt i32 %9, %12
br i1 %13, label %14, label %24
14: ; preds = %8
%15 = load i32*, i32** %4
%16 = load i32*, i32** %5
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = call i32 @fscanf(i32* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %8
24: ; preds = %8
%25 = load i32*, i32** %4
%26 = load i32*, i32** %5
%27 = load i32*, i32** %6
%28 = load i32, i32* %27
%29 = sub nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %26, i64 %30
%32 = call i32 @fscanf(i32* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %31)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d,\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @parse_problem(i32* nocapture %0, i32* %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 1
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = add nsw i32 %4, -1
%8 = sext i32 %7 to i64
br label %9
9: ; preds = %13, %6
%10 = phi i64 [ %8, %6 ], [ %20, %13 ]
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = tail call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %11)
ret void
13: ; preds = %3, %13
%14 = phi i64 [ %17, %13 ], [ 0, %3 ]
%15 = getelementptr inbounds i32, i32* %1, i64 %14
%16 = tail call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = add nuw nsw i64 %14, 1
%18 = load i32, i32* %2
%19 = add nsw i32 %18, -1
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %17, %20
br i1 %21, label %13, label %9
}