#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 *);
int *ivector(int, int);
void ReadSequence(FILE *fp, int *pT, int **pO) {
  int *O;
  int i;
  fscanf(fp, "T= %d\n", pT);
  O = ivector(1, *pT);
  for (i = 1; i <= *pT; i++)
    fscanf(fp, "%d", &O[i]);
  *pO = O;
}


x86 assembly (clang, -O0):
<ReadSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xebd(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    $0x1,%edi
call   1040 <ivector@plt>
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jg     119f <ReadSequence+0x7f>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe7b(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1163 <ReadSequence+0x43>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadSequence>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
mov    %rsi,%r13
mov    %rdi,%r15
lea    0xec4(%rip),%rsi
mov    %r13,%rdx
call   1030 <fscanf@plt>
mov    0x0(%r13),%esi
mov    $0x1,%edi
call   1040 <ivector@plt>
mov    %rax,%r12
cmpl   $0x0,0x0(%r13)
jle    118f <ReadSequence+0x6f>
mov    %r12,%rbx
add    $0x4,%rbx
xor    %r14d,%r14d
lea    0xe9a(%rip),%rbp
nopl   (%rax)
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1030 <fscanf@plt>
movslq 0x0(%r13),%rax
add    $0x1,%r14
add    $0x4,%rbx
cmp    %rax,%r14
jl     1170 <ReadSequence+0x50>
mov    (%rsp),%rax
mov    %r12,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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