#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 /*<<< orphan*/ printf(char *, ...);
int scanf(char *, int *, ...);
int main() {
  int n, total_joao, total_ze, deposito_joao, deposito_ze, teste = 1, i;
  while (scanf("%d", &n) == 1 && n > 0) {
    total_joao = 0;
    total_ze = 0;
    printf("Teste %d\n", teste++);
    for (i = 0; i < n; i++) {
      scanf("%d %d", &deposito_joao, &deposito_ze);
      total_joao += deposito_joao;
      total_ze += deposito_ze;
      printf("%d\n", total_joao - total_ze);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x21(%rbp)
jne    1162 <main+0x42>
cmpl   $0x0,-0x8(%rbp)
setg   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1172 <main+0x52>
jmp    1209 <main+0xe9>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x1c(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f6 <main+0xd6>
lea    0xe57(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a0 <main+0x80>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>
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    0xec8(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1229 <main+0xf9>
cmpl   $0x0,0x8(%rsp)
jle    1229 <main+0xf9>
mov    $0x1,%esi
nopw   0x0(%rax,%rax,1)
lea    0xe89(%rip),%rdi
mov    %esi,0xc(%rsp)
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x8(%rsp)
lea    0xe7c(%rip),%rax
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r13
jle    11f5 <main+0xc5>
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rcx,%rbp
mov    %rcx,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
add    0x14(%rsp),%r12d
add    0x10(%rsp),%r15d
mov    %r12d,%esi
sub    %r15d,%esi
lea    0xe29(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rcx
mov    %rbx,%rax
add    $0x1,%r14d
cmp    0x8(%rsp),%r14d
jl     11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe07(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
mov    0xc(%rsp),%esi
jne    1229 <main+0xf9>
add    $0x1,%esi
cmpl   $0x0,0x8(%rsp)
jg     1170 <main+0x40>
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 = [10 x i8] c"Teste %d\0A\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [2 x i8] c"\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
store i32 0, i32* %1
store i32 1, i32* %7
br label %9
9: ; preds = %40, %0
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 0
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ false, %9 ], [ %14, %12 ]
br i1 %16, label %17, label %42
17: ; preds = %15
store i32 0, i32* %3
store i32 0, i32* %4
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %18)
store i32 0, i32* %8
br label %21
21: ; preds = %37, %17
%22 = load i32, i32* %8
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %40
25: ; preds = %21
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6)
%27 = load i32, i32* %5
%28 = load i32, i32* %3
%29 = add nsw i32 %28, %27
store i32 %29, i32* %3
%30 = load i32, i32* %6
%31 = load i32, i32* %4
%32 = add nsw i32 %31, %30
store i32 %32, i32* %4
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = sub nsw i32 %33, %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %25
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %21
40: ; preds = %21
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %9
42: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"Teste %d\0A\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = icmp eq i32 %7, 1
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %12, label %39
12: ; preds = %0, %32
%13 = phi i32 [ %14, %32 ], [ 1, %0 ]
%14 = add nuw nsw i32 %13, 1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%16 = load i32, i32* %1
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %32
18: ; preds = %12, %18
%19 = phi i32 [ %29, %18 ], [ 0, %12 ]
%20 = phi i32 [ %26, %18 ], [ 0, %12 ]
%21 = phi i32 [ %24, %18 ], [ 0, %12 ]
%22 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3)
%23 = load i32, i32* %2
%24 = add nsw i32 %23, %21
%25 = load i32, i32* %3
%26 = add nsw i32 %25, %20
%27 = sub nsw i32 %24, %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i32 %19, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %29, %30
br i1 %31, label %18, label %32
32: ; preds = %18, %12
%33 = call i32 @putchar(i32 10)
%34 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%35 = icmp eq i32 %34, 1
%36 = load i32, i32* %1
%37 = icmp sgt i32 %36, 0
%38 = select i1 %35, i1 %37, i1 false
br i1 %38, label %12, label %39
39: ; preds = %32, %0
ret i32 0
}