#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main() {
  setlocale(LC_ALL, "RUS");
  int x, positive_sum = 0, negative_sum = 0;
  do {
    printf("\nВведите целое число (0 - для остановки): ");
    scanf("%d", &x);
    if (x > 0)
      positive_sum += x;
    else
      negative_sum += x;
  } while (x != 0);
  printf("Сумма положительных чисел: %d\n", positive_sum);
  printf("Сумма отрицательных чисел: %d\n", negative_sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1040 <setlocale@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1198 <main+0x68>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11a1 <main+0x71>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11a6 <main+0x76>
cmpl   $0x0,-0x8(%rbp)
jne    1162 <main+0x32>
mov    -0xc(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
call   1040 <setlocale@plt>
xor    %r13d,%r13d
lea    0xeaa(%rip),%r14
lea    0xeeb(%rip),%r15
lea    0x4(%rsp),%r12
xor    %ebp,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
mov    $0x0,%ecx
cmovg  %eax,%ecx
mov    %eax,%edx
cmovg  %r13d,%edx
add    %ecx,%ebp
add    %edx,%ebx
test   %eax,%eax
jne    1170 <main+0x40>
lea    0xea7(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [4 x i8] c"RUS\00"
@.str.1 = [72 x i8] c"\0A\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\86\D0\B5\D0\BB\D0\BE\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE (0 - \D0\B4\D0\BB\D1\8F \D0\BE\D1\81\D1\82\D0\B0\D0\BD\D0\BE\D0\B2\D0\BA\D0\B8): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [54 x i8] c"\D0\A1\D1\83\D0\BC\D0\BC\D0\B0 \D0\BF\D0\BE\D0\BB\D0\BE\D0\B6\D0\B8\D1\82\D0\B5\D0\BB\D1\8C\D0\BD\D1\8B\D1\85 \D1\87\D0\B8\D1\81\D0\B5\D0\BB: %d\0A\00"
@.str.4 = [54 x i8] c"\D0\A1\D1\83\D0\BC\D0\BC\D0\B0 \D0\BE\D1\82\D1\80\D0\B8\D1\86\D0\B0\D1\82\D0\B5\D0\BB\D1\8C\D0\BD\D1\8B\D1\85 \D1\87\D0\B8\D1\81\D0\B5\D0\BB: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @LC_ALL
%6 = call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %21, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = add nsw i32 %14, %13
store i32 %15, i32* %3
br label %20
16: ; preds = %7
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = add nsw i32 %18, %17
store i32 %19, i32* %4
br label %20
20: ; preds = %16, %12
br label %21
21: ; preds = %20
%22 = load i32, i32* %2
%23 = icmp ne i32 %22, 0
br i1 %23, label %7, label %24
24: ; preds = %21
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [4 x i8] c"RUS\00"
@.str.1 = [72 x i8] c"\0A\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\86\D0\B5\D0\BB\D0\BE\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE (0 - \D0\B4\D0\BB\D1\8F \D0\BE\D1\81\D1\82\D0\B0\D0\BD\D0\BE\D0\B2\D0\BA\D0\B8): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [54 x i8] c"\D0\A1\D1\83\D0\BC\D0\BC\D0\B0 \D0\BF\D0\BE\D0\BB\D0\BE\D0\B6\D0\B8\D1\82\D0\B5\D0\BB\D1\8C\D0\BD\D1\8B\D1\85 \D1\87\D0\B8\D1\81\D0\B5\D0\BB: %d\0A\00"
@.str.4 = [54 x i8] c"\D0\A1\D1\83\D0\BC\D0\BC\D0\B0 \D0\BE\D1\82\D1\80\D0\B8\D1\86\D0\B0\D1\82\D0\B5\D0\BB\D1\8C\D0\BD\D1\8B\D1\85 \D1\87\D0\B8\D1\81\D0\B5\D0\BB: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
br label %5
5: ; preds = %5, %0
%6 = phi i32 [ 0, %0 ], [ %13, %5 ]
%7 = phi i32 [ 0, %0 ], [ %15, %5 ]
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
%12 = select i1 %11, i32 %10, i32 0
%13 = add nuw nsw i32 %12, %6
%14 = select i1 %11, i32 0, i32 %10
%15 = add nsw i32 %14, %7
%16 = icmp eq i32 %10, 0
br i1 %16, label %17, label %5
17: ; preds = %5
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32 %15)
ret i32 0
}