#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 */

/* Variables and functions */
int *malloc(int);
int /*<<< orphan*/ mostra(int *, int);
int /*<<< orphan*/ printf(char *, int, ...);
int scanf(char *, int *, ...);
int somavec(int *, int, int);
int main() {
  int *v = NULL, a = 0, b = 0, tam = 0;
  int lido = 0;
  v = malloc(sizeof(int) * 100);
  scanf("%d %d", &a, &b);
  while (scanf("%d,", &lido) == 1) {
    v[tam] = lido;
    tam++;
  }
  mostra(v, tam);
  printf("Somando de %d a %d\n", a, b);
  printf("A soma é: %d\n ", somavec(v, a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    $0x190,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe68(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe58(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    11de <main+0x8e>
mov    -0x20(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a7 <main+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <mostra@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <somavec@plt>
mov    %eax,%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
mov    $0x190,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xe79(%rip),%rdi
xor    %ebx,%ebx
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe65(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    11de <main+0x8e>
lea    0xe4d(%rip),%r15
lea    0xc(%rsp),%r12
xor    %ebx,%ebx
mov    0xc(%rsp),%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmp    $0x1,%eax
je     11c0 <main+0x70>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <mostra@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    0xe13(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r14,%rdi
call   1050 <somavec@plt>
lea    0xe09(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d,\00"
@.str.2 = [20 x i8] c"Somando de %d a %d\0A\00"
@.str.3 = [16 x i8] c"A soma \C3\A9: %d\0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = call i32* @malloc(i32 400)
store i32* %7, i32** %2
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
br label %9
9: ; preds = %12, %0
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32, i32* %6
%14 = load i32*, i32** %2
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
store i32 %13, i32* %17
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %9
20: ; preds = %9
%21 = load i32*, i32** %2
%22 = load i32, i32* %5
%23 = call i32 @mostra(i32* %21, i32 %22)
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 %25)
%27 = load i32*, i32** %2
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = call i32 @somavec(i32* %27, i32 %28, i32 %29)
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d,\00"
@.str.2 = [20 x i8] c"Somando de %d a %d\0A\00"
@.str.3 = [16 x i8] c"A soma \C3\A9: %d\0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32* @malloc(i32 400)
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %20
11: ; preds = %0, %11
%12 = phi i64 [ %15, %11 ], [ 0, %0 ]
%13 = load i32, i32* %3
%14 = getelementptr inbounds i32, i32* %7, i64 %12
store i32 %13, i32* %14
%15 = add nuw i64 %12, 1
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = icmp eq i32 %16, 1
br i1 %17, label %11, label %18
18: ; preds = %11
%19 = trunc i64 %15 to i32
br label %20
20: ; preds = %18, %0
%21 = phi i32 [ 0, %0 ], [ %19, %18 ]
%22 = call i32 @mostra(i32* %7, i32 %21)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = call i32 @somavec(i32* %7, i32 %26, i32 %27)
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %28)
ret i32 0
}