#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int saladiobasico = 800;
  int nrovendedor = 0;
  int venta = 1;
  int acum = 0;
  int cont = 0;
  int comision1 = 0;
  int comision2;
  int salario;
  printf("Ingrese el numero de vendedor \n");
  scanf("%d", &nrovendedor);
  while (venta != 0) {
    printf("Ingrese el importe de la venta \n");
    scanf("%d", &venta);
    acum = acum + venta;
    cont = cont + 1;
  }
  comision1 = cont * 50;
  comision2 = acum * 5;
  comision2 = comision2 / 100;
  salario = saladiobasico + comision1 + comision2;
  printf("El vendedor %d realizo un total de %d venta/s, el salario total del "
         "mes es %d ARS \n",
         nrovendedor, cont, salario);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x320,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
je     11b6 <main+0x96>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1177 <main+0x57>
imul   $0x32,-0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
imul   $0x5,-0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <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
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x1,(%rsp)
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
lea    0xea3(%rip),%r14
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
xor    %ebx,%ebx
mov    $0x320,%ebp
lea    0xefe(%rip),%r15
mov    %rsp,%r12
xor    %r13d,%r13d
xchg   %ax,%ax
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%eax
add    %eax,%ebx
add    $0x1,%r13d
add    $0x32,%ebp
test   %eax,%eax
jne    1180 <main+0x50>
movslq %ebx,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x23,%rcx
add    %eax,%ecx
add    %ebp,%ecx
mov    0x4(%rsp),%esi
lea    0xe3c(%rip),%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Ingrese el numero de vendedor \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"Ingrese el importe de la venta \0A\00"
@.str.3 = [84 x i8] c"El vendedor %d realizo un total de %d venta/s, el salario total del mes es %d ARS \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 800, i32* %2
store i32 0, i32* %3
store i32 1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %12
12: ; preds = %15, %0
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
store i32 %20, i32* %5
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %12
23: ; preds = %12
%24 = load i32, i32* %6
%25 = mul nsw i32 %24, 50
store i32 %25, i32* %7
%26 = load i32, i32* %5
%27 = mul nsw i32 %26, 5
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = sdiv i32 %28, 100
store i32 %29, i32* %8
%30 = load i32, i32* %2
%31 = load i32, i32* %7
%32 = add nsw i32 %30, %31
%33 = load i32, i32* %8
%34 = add nsw i32 %32, %33
store i32 %34, i32* %9
%35 = load i32, i32* %3
%36 = load i32, i32* %6
%37 = load i32, i32* %9
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.3, i64 0, i64 0), i32 %35, i32 %36, i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [84 x i8] c"El vendedor %d realizo un total de %d venta/s, el salario total del mes es %d ARS \0A\00"
@str = [31 x i8] c"Ingrese el numero de vendedor \00"
@str.4 = [32 x i8] c"Ingrese el importe de la venta \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %7
7: ; preds = %0, %7
%8 = phi i32 [ %13, %7 ], [ 0, %0 ]
%9 = phi i32 [ %14, %7 ], [ 0, %0 ]
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = add nsw i32 %12, %8
%14 = add nuw nsw i32 %9, 1
%15 = icmp eq i32 %12, 0
br i1 %15, label %16, label %7
16: ; preds = %7
%17 = sdiv i32 %13, 20
%18 = mul nsw i32 %14, 50
%19 = add nuw nsw i32 %18, 800
%20 = add nsw i32 %19, %17
%21 = load i32, i32* %1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %14, i32 %20)
ret i32 0
}