#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 print_it(int id, int tot) {
  int j = 1, r = 1, tran;
  tot = 0;
  printf("Please enter the id number\n");
  scanf("%d", &id);
  while (j <= 7) {
    printf("enter the transaction amount\n");
    scanf("%d", &tran);
    if (tran > 0)
      tot = tot + tran;
    else
      tot = tot + ((-1) * tran);
    j += 1;
  }
  return tot;
}


x86 assembly (clang, -O0):
<print_it>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x7,-0xc(%rbp)
jg     11ba <print_it+0x9a>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    119d <print_it+0x7d>
mov    -0x8(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11ac <print_it+0x8c>
mov    -0x8(%rbp),%eax
imul   $0xffffffff,-0x14(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <print_it+0x3f>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_it>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%r12
lea    0xc(%rsp),%rsi
mov    %r12,%rdi
call   1040 <scanf@plt>
lea    0xec7(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%ebp
neg    %ebp
cmovs  %eax,%ebp
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%ebx
neg    %ebx
cmovs  %eax,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%ebp
neg    %ebp
cmovs  %eax,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%ebx
neg    %ebx
cmovs  %eax,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%ebp
neg    %ebp
cmovs  %eax,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%ebx
neg    %ebx
cmovs  %eax,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%ecx
mov    %ecx,%eax
neg    %eax
cmovs  %ecx,%eax
add    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Please enter the id number\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"enter the transaction amount\0A\00"
define i32 @print_it(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
store i32 1, i32* %6
store i32 0, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %10
10: ; preds = %27, %2
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 7
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%16 = load i32, i32* %7
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = load i32, i32* %4
%20 = load i32, i32* %7
%21 = add nsw i32 %19, %20
store i32 %21, i32* %4
br label %27
22: ; preds = %13
%23 = load i32, i32* %4
%24 = load i32, i32* %7
%25 = mul nsw i32 -1, %24
%26 = add nsw i32 %23, %25
store i32 %26, i32* %4
br label %27
27: ; preds = %22, %18
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %10
30: ; preds = %10
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [27 x i8] c"Please enter the id number\00"
@str.3 = [29 x i8] c"enter the transaction amount\00"
define i32 @print_it(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
%11 = call i32 @llvm.abs.i32(i32 %10, i1 false)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %4
%15 = call i32 @llvm.abs.i32(i32 %14, i1 false)
%16 = add i32 %15, %11
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %4
%20 = call i32 @llvm.abs.i32(i32 %19, i1 false)
%21 = add i32 %20, %16
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%24 = load i32, i32* %4
%25 = call i32 @llvm.abs.i32(i32 %24, i1 false)
%26 = add i32 %25, %21
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%29 = load i32, i32* %4
%30 = call i32 @llvm.abs.i32(i32 %29, i1 false)
%31 = add i32 %30, %26
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%34 = load i32, i32* %4
%35 = call i32 @llvm.abs.i32(i32 %34, i1 false)
%36 = add i32 %35, %31
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%39 = load i32, i32* %4
%40 = call i32 @llvm.abs.i32(i32 %39, i1 false)
%41 = add i32 %40, %36
ret i32 %41
}