#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 elements[5][4];
  int i, j;
  printf("Please input the %d*%d matrix:\n", 5, 4);
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 4; j++) {
      scanf("%d", &elements[i][j]);
      if (elements[i][j] > 100) {
        elements[i][j] = 1;
      } else {
        elements[i][j] = 0;
      }
    }
  }
  printf("Now the matrix looks like this:\n");
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 4; j++) {
      printf("%3d", elements[i][j]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x5,%esi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x5,-0x64(%rbp)
jge    120b <main+0xeb>
movl   $0x0,-0x68(%rbp)
cmpl   $0x4,-0x68(%rbp)
jge    11f8 <main+0xd8>
movslq -0x64(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x68(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe96(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x64(%rbp),%rcx
lea    -0x60(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
cmpl   $0x64,(%rax,%rcx,4)
jle    11cb <main+0xab>
movslq -0x64(%rbp),%rcx
lea    -0x60(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    11e5 <main+0xc5>
movslq -0x64(%rbp),%rcx
lea    -0x60(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    11ea <main+0xca>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    115f <main+0x3f>
jmp    11fd <main+0xdd>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    114e <main+0x2e>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x5,-0x64(%rbp)
jge    1289 <main+0x169>
movl   $0x0,-0x68(%rbp)
cmpl   $0x4,-0x68(%rbp)
jge    126d <main+0x14d>
movslq -0x64(%rbp),%rcx
lea    -0x60(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1231 <main+0x111>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1220 <main+0x100>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
lea    0xeb0(%rip),%rdi
mov    $0x5,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rbx
mov    $0x5,%r15d
lea    0xead(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x8(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
xor    %eax,%eax
cmpl   $0x65,-0x8(%rbx)
setge  %al
mov    %eax,-0x8(%rbx)
lea    -0x4(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
xor    %eax,%eax
cmpl   $0x65,-0x4(%rbx)
setge  %al
mov    %eax,-0x4(%rbx)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
cmpl   $0x65,(%rbx)
setge  %al
mov    %eax,(%rbx)
lea    0x4(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
xor    %eax,%eax
cmpl   $0x65,0x4(%rbx)
setge  %al
mov    %eax,0x4(%rbx)
add    $0x10,%rbx
add    $0xffffffffffffffff,%r15
jne    1180 <main+0x40>
lea    0xe39(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
lea    0xe26(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [32 x i8] c"Please input the %d*%d matrix:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%3d\00"
@str = [32 x i8] c"Now the matrix looks like this:\00"
define i32 @main() {
%1 = alloca [5 x [4 x i32]]
%2 = bitcast [5 x [4 x i32]]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 5, i32 4)
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %26, %4 ]
%6 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 %5, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = load i32, i32* %6
%9 = icmp sgt i32 %8, 100
%10 = zext i1 %9 to i32
store i32 %10, i32* %6
%11 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 %5, i64 1
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %11
%14 = icmp sgt i32 %13, 100
%15 = zext i1 %14 to i32
store i32 %15, i32* %11
%16 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 %5, i64 2
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %16
%19 = icmp sgt i32 %18, 100
%20 = zext i1 %19 to i32
store i32 %20, i32* %16
%21 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 %5, i64 3
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %21)
%23 = load i32, i32* %21
%24 = icmp sgt i32 %23, 100
%25 = zext i1 %24 to i32
store i32 %25, i32* %21
%26 = add nuw nsw i64 %5, 1
%27 = icmp eq i64 %26, 5
br i1 %27, label %28, label %4
28: ; preds = %4
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%30 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 0, i64 0
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 0, i64 1
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 0, i64 2
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 0, i64 3
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = call i32 @putchar(i32 10)
%43 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 1, i64 0
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 1, i64 1
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 1, i64 2
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 1, i64 3
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %53)
%55 = call i32 @putchar(i32 10)
%56 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 2, i64 0
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 2, i64 1
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 2, i64 2
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 2, i64 3
%66 = load i32, i32* %65
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %66)
%68 = call i32 @putchar(i32 10)
%69 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 3, i64 0
%70 = load i32, i32* %69
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %70)
%72 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 3, i64 1
%73 = load i32, i32* %72
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %73)
%75 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 3, i64 2
%76 = load i32, i32* %75
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %76)
%78 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 3, i64 3
%79 = load i32, i32* %78
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %79)
%81 = call i32 @putchar(i32 10)
%82 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 4, i64 0
%83 = load i32, i32* %82
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %83)
%85 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 4, i64 1
%86 = load i32, i32* %85
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %86)
%88 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 4, i64 2
%89 = load i32, i32* %88
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %89)
%91 = getelementptr inbounds [5 x [4 x i32]], [5 x [4 x i32]]* %1, i64 0, i64 4, i64 3
%92 = load i32, i32* %91
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %92)
%94 = call i32 @putchar(i32 10)
ret i32 0
}