#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 abs(int);
int /*<<< orphan*/ printf(char *, int, ...);
scalar_t__ scanf(char *, int *);
int main() {
  int num, maior = 0, menor = 999999, total = 0;
  int maior_count = 0, menor_count = 0, count = 1;
  while (scanf("%d", &num)) {
    if (num == 0)
      break;
    if (num < 0) {
      int next;
      scanf("%d", &next);
      num = abs(num);
      num += next;
    }
    if (num < menor && num > 0) {
      menor = num;
      menor_count = count;
    }
    if (num > maior) {
      maior = num;
      maior_count = count;
    }
    total += num;
    count++;
  }
  printf("Melhor volta: %d - %d seg\n", menor_count, menor);
  printf("Pior volta: %d - %d seg\n", maior_count, maior);
  printf("Tempo total: %d seg\n", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xf423f,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
lea    0xe90(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x0,%rax
je     1211 <main+0xe1>
cmpl   $0x0,-0x8(%rbp)
jne    1192 <main+0x62>
jmp    1211 <main+0xe1>
cmpl   $0x0,-0x8(%rbp)
jge    11c0 <main+0x90>
lea    0xe5d(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x8(%rbp)
mov    -0x24(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11e2 <main+0xb2>
cmpl   $0x0,-0x8(%rbp)
jle    11e2 <main+0xb2>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11fa <main+0xca>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1169 <main+0x39>
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
xor    %r14d,%r14d
mov    $0xf423f,%edx
test   %rax,%rax
je     1211 <main+0xf1>
mov    0xc(%rsp),%eax
movl   $0x0,0x10(%rsp)
mov    $0x0,%r15d
mov    $0x0,%esi
test   %eax,%eax
je     1224 <main+0x104>
mov    $0xf423f,%r12d
xor    %ebx,%ebx
mov    $0x1,%r13d
xor    %r15d,%r15d
movl   $0x0,0x10(%rsp)
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
jns    11ba <main+0x9a>
mov    %ebx,%ebp
lea    0xe63(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    %ecx,%eax
neg    %eax
cmovs  %ecx,%eax
add    0x14(%rsp),%eax
mov    %eax,0xc(%rsp)
cmp    %r12d,%eax
setl   %cl
test   %eax,%eax
setg   %dl
mov    %eax,%esi
mov    %r13d,%edi
test   %dl,%cl
jne    11d3 <main+0xb3>
mov    %r12d,%esi
mov    %ebx,%edi
mov    %edi,%ebx
mov    %esi,%ebp
cmp    %r14d,%eax
cmovg  %eax,%r14d
cmovg  %r13d,%r15d
add    %eax,0x10(%rsp)
lea    0xe13(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     1220 <main+0x100>
add    $0x1,%r13d
mov    0xc(%rsp),%eax
mov    %ebx,%esi
mov    %ebp,%edx
mov    %ebp,%r12d
test   %eax,%eax
jne    1190 <main+0x70>
jmp    1224 <main+0x104>
movl   $0x0,0x10(%rsp)
xor    %r15d,%r15d
xor    %esi,%esi
jmp    1224 <main+0x104>
mov    %ebp,%edx
mov    %ebx,%esi
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde5(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdea(%rip),%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [27 x i8] c"Melhor volta: %d - %d seg\0A\00"
@.str.2 = [25 x i8] c"Pior volta: %d - %d seg\0A\00"
@.str.3 = [21 x i8] c"Tempo total: %d seg\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 999999, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
br label %10
10: ; preds = %44, %0
%11 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %50
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
br label %50
17: ; preds = %13
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%22 = load i32, i32* %2
%23 = call i32 @abs(i32 %22)
store i32 %23, i32* %2
%24 = load i32, i32* %9
%25 = load i32, i32* %2
%26 = add nsw i32 %25, %24
store i32 %26, i32* %2
br label %27
27: ; preds = %20, %17
%28 = load i32, i32* %2
%29 = load i32, i32* %4
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %37
31: ; preds = %27
%32 = load i32, i32* %2
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %2
store i32 %35, i32* %4
%36 = load i32, i32* %8
store i32 %36, i32* %7
br label %37
37: ; preds = %34, %31, %27
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = icmp sgt i32 %38, %39
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = load i32, i32* %2
store i32 %42, i32* %3
%43 = load i32, i32* %8
store i32 %43, i32* %6
br label %44
44: ; preds = %41, %37
%45 = load i32, i32* %2
%46 = load i32, i32* %5
%47 = add nsw i32 %46, %45
store i32 %47, i32* %5
%48 = load i32, i32* %8
%49 = add nsw i32 %48, 1
store i32 %49, i32* %8
br label %10
50: ; preds = %16, %10
%51 = load i32, i32* %7
%52 = load i32, i32* %4
%53 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %51, i32 %52)
%54 = load i32, i32* %6
%55 = load i32, i32* %3
%56 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %54, i32 %55)
%57 = load i32, i32* %5
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %57)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [27 x i8] c"Melhor volta: %d - %d seg\0A\00"
@.str.2 = [25 x i8] c"Pior volta: %d - %d seg\0A\00"
@.str.3 = [21 x i8] c"Tempo total: %d seg\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = icmp eq i64 %4, 0
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
%8 = select i1 %5, i1 true, i1 %7
br i1 %8, label %43, label %9
9: ; preds = %0
%10 = bitcast i32* %2 to i8*
br label %11
11: ; preds = %9, %26
%12 = phi i32 [ %6, %9 ], [ %40, %26 ]
%13 = phi i32 [ 1, %9 ], [ %37, %26 ]
%14 = phi i32 [ 0, %9 ], [ %32, %26 ]
%15 = phi i32 [ 0, %9 ], [ %35, %26 ]
%16 = phi i32 [ 0, %9 ], [ %36, %26 ]
%17 = phi i32 [ 999999, %9 ], [ %31, %26 ]
%18 = phi i32 [ 0, %9 ], [ %34, %26 ]
%19 = icmp slt i32 %12, 0
br i1 %19, label %20, label %26
20: ; preds = %11
%21 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%22 = load i32, i32* %1
%23 = call i32 @llvm.abs.i32(i32 %22, i1 true)
%24 = load i32, i32* %2
%25 = add nsw i32 %24, %23
store i32 %25, i32* %1
br label %26
26: ; preds = %20, %11
%27 = phi i32 [ %25, %20 ], [ %12, %11 ]
%28 = icmp slt i32 %27, %17
%29 = icmp sgt i32 %27, 0
%30 = and i1 %28, %29
%31 = select i1 %30, i32 %27, i32 %17
%32 = select i1 %30, i32 %13, i32 %14
%33 = icmp sgt i32 %27, %18
%34 = select i1 %33, i32 %27, i32 %18
%35 = select i1 %33, i32 %13, i32 %15
%36 = add nsw i32 %27, %16
%37 = add nuw nsw i32 %13, 1
%38 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%39 = icmp eq i64 %38, 0
%40 = load i32, i32* %1
%41 = icmp eq i32 %40, 0
%42 = select i1 %39, i1 true, i1 %41
br i1 %42, label %43, label %11
43: ; preds = %26, %0
%44 = phi i32 [ 0, %0 ], [ %34, %26 ]
%45 = phi i32 [ 999999, %0 ], [ %31, %26 ]
%46 = phi i32 [ 0, %0 ], [ %36, %26 ]
%47 = phi i32 [ 0, %0 ], [ %35, %26 ]
%48 = phi i32 [ 0, %0 ], [ %32, %26 ]
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %48, i32 %45)
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %47, i32 %44)
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %46)
ret i32 0
}