#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 pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a[10][10];
  int n, m;
  printf("Numarul de linii\n");
  scanf("%d", &m);
  printf("Numarul de coloane\n");
  scanf("%d", &n);
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      printf("a[%d][%d]= ", j, i);
      scanf("%d", &a[i][j]);
    }
  }
  int zecimal = 0;
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      zecimal += a[i][j] * pow(2, j);
    }
    printf("%d ", zecimal);
    zecimal = 0;
  }
  printf("\nExit...\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x1a8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    1232 <main+0x102>
movl   $0x0,-0x1b0(%rbp)
mov    -0x1b0(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    1219 <main+0xe9>
mov    -0x1b0(%rbp),%esi
mov    -0x1ac(%rbp),%edx
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x1ac(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
imul   $0x28,%rax,%rax
add    %rax,%rsi
movslq -0x1b0(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe12(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x1b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
jmp    11aa <main+0x7a>
jmp    121e <main+0xee>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    118e <main+0x5e>
movl   $0x0,-0x1b4(%rbp)
movl   $0x0,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    1306 <main+0x1d6>
movl   $0x0,-0x1bc(%rbp)
mov    -0x1bc(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    12d4 <main+0x1a4>
movslq -0x1b8(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1bc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c0(%rbp)
mov    -0x1bc(%rbp),%esi
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x1c0(%rbp),%eax
imul   %ecx,%eax
add    -0x1b4(%rbp),%eax
mov    %eax,-0x1b4(%rbp)
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    1262 <main+0x132>
mov    -0x1b4(%rbp),%esi
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1b4(%rbp)
mov    -0x1b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b8(%rbp)
jmp    1246 <main+0x116>
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    1286 <main+0x146>
lea    0x10(%rsp),%r13
mov    0x8(%rsp),%eax
lea    0xe5d(%rip),%r14
lea    0xe53(%rip),%r15
xor    %r12d,%r12d
jmp    11d0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r12
movslq %ecx,%rdx
add    $0x28,%r13
cmp    %rdx,%r12
jge    1212 <main+0xd2>
test   %eax,%eax
jle    11c0 <main+0x80>
mov    %r13,%rbp
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%rbp
cmp    %rax,%rbx
jl     11e0 <main+0xa0>
mov    0xc(%rsp),%ecx
jmp    11c0 <main+0x80>
test   %ecx,%ecx
jle    1286 <main+0x146>
lea    0x10(%rsp),%r15
lea    0xded(%rip),%r14
xor    %r12d,%r12d
jmp    124e <main+0x10e>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12
movslq 0xc(%rsp),%rax
add    $0x28,%r15
cmp    %rax,%r12
jge    1286 <main+0x146>
cmpl   $0x0,0x8(%rsp)
mov    $0x0,%ebp
jle    1230 <main+0xf0>
xor    %ebx,%ebx
xor    %ebp,%ebp
xchg   %ax,%ax
mov    (%r15,%rbx,4),%r13d
mov    $0x2,%edi
mov    %ebx,%esi
call   1060 <pow@plt>
imul   %r13d,%eax
add    %eax,%ebp
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1260 <main+0x120>
jmp    1230 <main+0xf0>
lea    0xdaa(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Numarul de linii\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Numarul de coloane\0A\00"
@.str.3 = [12 x i8] c"a[%d][%d]= \00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [10 x i8] c"\0AExit...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [10 x 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
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 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* %4)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 0, i32* %5
br label %14
14: ; preds = %38, %0
%15 = load i32, i32* %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %41
18: ; preds = %14
store i32 0, i32* %6
br label %19
19: ; preds = %34, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %3
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %37
23: ; preds = %19
%24 = load i32, i32* %6
%25 = load i32, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %24, i32 %25)
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %28
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %29, i64 0, i64 %31
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %32)
br label %34
34: ; preds = %23
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %19
37: ; preds = %19
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %14
41: ; preds = %14
store i32 0, i32* %7
store i32 0, i32* %8
br label %42
42: ; preds = %70, %41
%43 = load i32, i32* %8
%44 = load i32, i32* %4
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %73
46: ; preds = %42
store i32 0, i32* %9
br label %47
47: ; preds = %64, %46
%48 = load i32, i32* %9
%49 = load i32, i32* %3
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %67
51: ; preds = %47
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %53
%55 = load i32, i32* %9
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i32], [10 x i32]* %54, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = load i32, i32* %9
%60 = call i32 @pow(i32 2, i32 %59)
%61 = mul nsw i32 %58, %60
%62 = load i32, i32* %7
%63 = add nsw i32 %62, %61
store i32 %63, i32* %7
br label %64
64: ; preds = %51
%65 = load i32, i32* %9
%66 = add nsw i32 %65, 1
store i32 %66, i32* %9
br label %47
67: ; preds = %47
%68 = load i32, i32* %7
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %68)
store i32 0, i32* %7
br label %70
70: ; preds = %67
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 1
store i32 %72, i32* %8
br label %42
73: ; preds = %42
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"a[%d][%d]= \00"
@.str.4 = [4 x i8] c"%d \00"
@str = [17 x i8] c"Numarul de linii\00"
@str.6 = [19 x i8] c"Numarul de coloane\00"
@str.7 = [9 x i8] c"\0AExit...\00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [10 x [10 x i32]]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %46
13: ; preds = %0
%14 = load i32, i32* %2
br label %15
15: ; preds = %13, %26
%16 = phi i32 [ %11, %13 ], [ %27, %26 ]
%17 = phi i32 [ %14, %13 ], [ %28, %26 ]
%18 = phi i64 [ 0, %13 ], [ %29, %26 ]
%19 = icmp sgt i32 %17, 0
br i1 %19, label %20, label %26
20: ; preds = %15
%21 = trunc i64 %18 to i32
br label %32
22: ; preds = %26
%23 = icmp sgt i32 %27, 0
br i1 %23, label %42, label %46
24: ; preds = %32
%25 = load i32, i32* %3
br label %26
26: ; preds = %24, %15
%27 = phi i32 [ %25, %24 ], [ %16, %15 ]
%28 = phi i32 [ %39, %24 ], [ %17, %15 ]
%29 = add nuw nsw i64 %18, 1
%30 = sext i32 %27 to i64
%31 = icmp slt i64 %29, %30
br i1 %31, label %15, label %22
32: ; preds = %20, %32
%33 = phi i64 [ 0, %20 ], [ %38, %32 ]
%34 = trunc i64 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %34, i32 %21)
%36 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %18, i64 %33
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %36)
%38 = add nuw nsw i64 %33, 1
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %32, label %24
42: ; preds = %22, %48
%43 = phi i64 [ %51, %48 ], [ 0, %22 ]
%44 = load i32, i32* %2
%45 = icmp sgt i32 %44, 0
br i1 %45, label %55, label %48
46: ; preds = %48, %0, %22
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.7, i64 0, i64 0))
ret i32 0
48: ; preds = %55, %42
%49 = phi i32 [ 0, %42 ], [ %63, %55 ]
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %49)
%51 = add nuw nsw i64 %43, 1
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = icmp slt i64 %51, %53
br i1 %54, label %42, label %46
55: ; preds = %42, %55
%56 = phi i64 [ %64, %55 ], [ 0, %42 ]
%57 = phi i32 [ %63, %55 ], [ 0, %42 ]
%58 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %43, i64 %56
%59 = load i32, i32* %58
%60 = trunc i64 %56 to i32
%61 = call i32 @pow(i32 2, i32 %60)
%62 = mul nsw i32 %61, %59
%63 = add nsw i32 %62, %57
%64 = add nuw nsw i64 %56, 1
%65 = load i32, i32* %2
%66 = sext i32 %65 to i64
%67 = icmp slt i64 %64, %66
br i1 %67, label %55, label %48
}