#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*/ printTable(int **);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int day, salesperson, product;
  int sales;
  int totalSales[5][6] = {{0}};
  for (day = 1; day <= 2; day++) {
    for (salesperson = 1; salesperson < 5; salesperson++) {
      printf("\nEnter product details of day %d for salesperson %d\n", day,
             salesperson);
      for (product = 1; product < 6; product++) {
        printf("Sales of product %d: ", product);
        scanf("%d", &sales);
        totalSales[salesperson][product] += sales;
      }
    }
  }
  printTable(totalSales);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x78,%edx
call   1040 <memset@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     1220 <main+0xe0>
movl   $0x1,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    120d <main+0xcd>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
cmpl   $0x6,-0x10(%rbp)
jge    11fa <main+0xba>
mov    -0x10(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%edx
movslq -0xc(%rbp),%rcx
lea    -0x90(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a2 <main+0x62>
jmp    11ff <main+0xbf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117d <main+0x3d>
jmp    1212 <main+0xd2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116c <main+0x2c>
lea    -0x90(%rbp),%rdi
call   1050 <printTable@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x80(%rsp)
mov    $0x1,%ebx
lea    0xe81(%rip),%r14
lea    0xeaf(%rip),%r15
lea    0xebe(%rip),%r12
lea    0xc(%rsp),%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x2c(%rsp,%rbp,1)
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x30(%rsp,%rbp,1)
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x34(%rsp,%rbp,1)
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x38(%rsp,%rbp,1)
mov    %r15,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x3c(%rsp,%rbp,1)
add    $0x1,%ebx
add    $0x18,%rbp
cmp    $0x60,%rbp
jne    11a0 <main+0x70>
mov    $0x1,%ebx
lea    0xd88(%rip),%r14
lea    0xdb6(%rip),%r15
lea    0xdc5(%rip),%r12
lea    0xc(%rsp),%r13
xor    %ebp,%ebp
nopl   (%rax)
mov    %r14,%rdi
mov    $0x2,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x2c(%rsp,%rbp,1)
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x30(%rsp,%rbp,1)
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x34(%rsp,%rbp,1)
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x38(%rsp,%rbp,1)
mov    %r15,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,0x3c(%rsp,%rbp,1)
add    $0x18,%rbp
add    $0x1,%ebx
cmp    $0x60,%rbp
jne    1290 <main+0x160>
lea    0x10(%rsp),%rdi
call   1040 <printTable@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"\0AEnter product details of day %d for salesperson %d\0A\00"
@.str.1 = [22 x i8] c"Sales of product %d: \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [5 x [6 x i32]]
store i32 0, i32* %1
%7 = bitcast [5 x [6 x i32]]* %6 to i8*
store i32 1, i32* %2
br label %8
8: ; preds = %43, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 2
br i1 %10, label %11, label %46
11: ; preds = %8
store i32 1, i32* %3
br label %12
12: ; preds = %39, %11
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 5
br i1 %14, label %15, label %42
15: ; preds = %12
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17)
store i32 1, i32* %4
br label %19
19: ; preds = %35, %15
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 6
br i1 %21, label %22, label %38
22: ; preds = %19
%23 = load i32, i32* %4
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %6, i64 0, i64 %28
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = add nsw i32 %33, %26
store i32 %34, i32* %32
br label %35
35: ; preds = %22
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %19
38: ; preds = %19
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %12
42: ; preds = %12
br label %43
43: ; preds = %42
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %8
46: ; preds = %8
%47 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %6, i64 0, i64 0
%48 = bitcast [6 x i32]* %47 to i32**
%49 = call i32 @printTable(i32** %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [53 x i8] c"\0AEnter product details of day %d for salesperson %d\0A\00"
@.str.1 = [22 x i8] c"Sales of product %d: \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [6 x i32]]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [5 x [6 x i32]]* %2 to i8*
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 1, %0 ], [ %39, %5 ]
%7 = trunc i64 %6 to i32
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 1, i32 %7)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 1)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %6, i64 1
%13 = load i32, i32* %12
%14 = add nsw i32 %13, %11
store i32 %14, i32* %12
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 2)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %6, i64 2
%19 = load i32, i32* %18
%20 = add nsw i32 %19, %17
store i32 %20, i32* %18
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 3)
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%23 = load i32, i32* %1
%24 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %6, i64 3
%25 = load i32, i32* %24
%26 = add nsw i32 %25, %23
store i32 %26, i32* %24
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 4)
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
%30 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %6, i64 4
%31 = load i32, i32* %30
%32 = add nsw i32 %31, %29
store i32 %32, i32* %30
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 5)
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%35 = load i32, i32* %1
%36 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %6, i64 5
%37 = load i32, i32* %36
%38 = add nsw i32 %37, %35
store i32 %38, i32* %36
%39 = add nuw nsw i64 %6, 1
%40 = icmp eq i64 %39, 5
br i1 %40, label %41, label %5
41: ; preds = %5, %41
%42 = phi i64 [ %75, %41 ], [ 1, %5 ]
%43 = trunc i64 %42 to i32
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 2, i32 %43)
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 1)
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%47 = load i32, i32* %1
%48 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %42, i64 1
%49 = load i32, i32* %48
%50 = add nsw i32 %49, %47
store i32 %50, i32* %48
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 2)
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%53 = load i32, i32* %1
%54 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %42, i64 2
%55 = load i32, i32* %54
%56 = add nsw i32 %55, %53
store i32 %56, i32* %54
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 3)
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%59 = load i32, i32* %1
%60 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %42, i64 3
%61 = load i32, i32* %60
%62 = add nsw i32 %61, %59
store i32 %62, i32* %60
%63 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 4)
%64 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%65 = load i32, i32* %1
%66 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %42, i64 4
%67 = load i32, i32* %66
%68 = add nsw i32 %67, %65
store i32 %68, i32* %66
%69 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 5)
%70 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%71 = load i32, i32* %1
%72 = getelementptr inbounds [5 x [6 x i32]], [5 x [6 x i32]]* %2, i64 0, i64 %42, i64 5
%73 = load i32, i32* %72
%74 = add nsw i32 %73, %71
store i32 %74, i32* %72
%75 = add nuw nsw i64 %42, 1
%76 = icmp eq i64 %75, 5
br i1 %76, label %77, label %41
77: ; preds = %41
%78 = bitcast [5 x [6 x i32]]* %2 to i32**
%79 = call i32 @printTable(i32** %78)
ret i32 0
}