#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  FILE *f1;
  f1 = fopen("8.out", "r");
  int i, a, b;
  int data[5][3];
  for (i = 0; i < 5; i++) {
    fscanf(f1, "%d %d %d", &data[i][0], &data[i][1], &data[i][2]);
  }
  printf("Enter the Product Code: ");
  scanf("%d", &a);
  for (i = 0; i < 5; i++) {
    if (a == data[i][0]) {
      printf("RECORD FOUND!!! \n");
      printf("Poduct Code: %d \nCost: %d\nQuantity: %d\n", data[i][0],
             data[i][1], data[i][2]);
      return 0;
    }
  }
  printf("SORRY RECORD NOT FOUND!!!! \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    11ca <main+0x8a>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
lea    -0x60(%rbp),%rdx
imul   $0xc,%rax,%rax
add    %rax,%rdx
movslq -0x14(%rbp),%rax
lea    -0x60(%rbp),%rcx
imul   $0xc,%rax,%rax
add    %rax,%rcx
add    $0x4,%rcx
movslq -0x14(%rbp),%rax
lea    -0x60(%rbp),%r8
imul   $0xc,%rax,%rax
add    %rax,%r8
add    $0x8,%r8
lea    0xe51(%rip),%rsi
call   1040 <fscanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <main+0x2d>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2f(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1283 <main+0x143>
mov    -0x18(%rbp),%eax
movslq -0x14(%rbp),%rdx
lea    -0x60(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cmp    (%rcx),%eax
jne    1270 <main+0x130>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x14(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%esi
movslq -0x14(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
movslq -0x14(%rbp),%rcx
lea    -0x60(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1298 <main+0x158>
jmp    1275 <main+0x135>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ef <main+0xaf>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xe9b(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbp
lea    0x10(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0xe7e(%rip),%r14
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <fscanf@plt>
lea    0x1c(%rsp),%rbx
lea    0x20(%rsp),%rcx
lea    0x24(%rsp),%r8
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <fscanf@plt>
lea    0x28(%rsp),%r15
lea    0x2c(%rsp),%rcx
lea    0x30(%rsp),%r8
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
lea    0x34(%rsp),%r12
lea    0x38(%rsp),%rcx
lea    0x3c(%rsp),%r8
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
lea    0x40(%rsp),%r13
lea    0x44(%rsp),%rcx
lea    0x48(%rsp),%r8
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1050 <fscanf@plt>
lea    0xe01(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdee(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    0x10(%rsp),%eax
jne    123b <main+0xeb>
lea    0x10(%rsp),%rbx
jmp    1270 <main+0x120>
mov    $0x1,%ebp
cmp    0x1c(%rsp),%eax
je     1270 <main+0x120>
mov    $0x2,%ebp
mov    %r15,%rbx
cmp    0x28(%rsp),%eax
je     1270 <main+0x120>
mov    $0x3,%ebp
mov    %r12,%rbx
cmp    0x34(%rsp),%eax
je     1270 <main+0x120>
mov    $0x4,%ebp
mov    %r13,%rbx
cmp    0x40(%rsp),%eax
jne    12b0 <main+0x160>
lea    0xdf7(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
lea    0x0(,%rbp,2),%rax
add    %rbp,%rax
mov    0x14(%rsp,%rax,4),%edx
mov    0x18(%rsp,%rax,4),%ecx
lea    0xd92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd9b(%rip),%rdi
call   1030 <puts@plt>
jmp    129f <main+0x14f>

LLVM IR (-O0):
@.str = [6 x i8] c"8.out\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%d %d %d\00"
@.str.3 = [25 x i8] c"Enter the Product Code: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [18 x i8] c"RECORD FOUND!!! \0A\00"
@.str.6 = [40 x i8] c"Poduct Code: %d \0ACost: %d\0AQuantity: %d\0A\00"
@.str.7 = [29 x i8] c"SORRY RECORD NOT FOUND!!!! \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [5 x [3 x i32]]
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
store i32 0, i32* %3
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i32*, i32** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %6, i64 0, i64 %14
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %15, i64 0, i64 0
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %6, i64 0, i64 %18
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %19, i64 0, i64 1
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %6, i64 0, i64 %22
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %23, i64 0, i64 2
%25 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %16, i32* %20, i32* %24)
br label %26
26: ; preds = %11
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %8
29: ; preds = %8
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
store i32 0, i32* %3
br label %32
32: ; preds = %62, %29
%33 = load i32, i32* %3
%34 = icmp slt i32 %33, 5
br i1 %34, label %35, label %65
35: ; preds = %32
%36 = load i32, i32* %4
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %6, i64 0, i64 %38
%40 = getelementptr inbounds [3 x i32], [3 x i32]* %39, i64 0, i64 0
%41 = load i32, i32* %40
%42 = icmp eq i32 %36, %41
br i1 %42, label %43, label %61
43: ; preds = %35
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %6, i64 0, i64 %46
%48 = getelementptr inbounds [3 x i32], [3 x i32]* %47, i64 0, i64 0
%49 = load i32, i32* %48
%50 = load i32, i32* %3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %6, i64 0, i64 %51
%53 = getelementptr inbounds [3 x i32], [3 x i32]* %52, i64 0, i64 1
%54 = load i32, i32* %53
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %6, i64 0, i64 %56
%58 = getelementptr inbounds [3 x i32], [3 x i32]* %57, i64 0, i64 2
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %49, i32 %54, i32 %59)
store i32 0, i32* %1
br label %67
61: ; preds = %35
br label %62
62: ; preds = %61
%63 = load i32, i32* %3
%64 = add nsw i32 %63, 1
store i32 %64, i32* %3
br label %32
65: ; preds = %32
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %1
br label %67
67: ; preds = %65, %43
%68 = load i32, i32* %1
ret i32 %68
}

LLVM IR (-O2):
@.str = [6 x i8] c"8.out\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%d %d %d\00"
@.str.3 = [25 x i8] c"Enter the Product Code: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.6 = [40 x i8] c"Poduct Code: %d \0ACost: %d\0AQuantity: %d\0A\00"
@str = [28 x i8] c"SORRY RECORD NOT FOUND!!!! \00"
@str.8 = [17 x i8] c"RECORD FOUND!!! \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [3 x i32]]
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = bitcast [5 x [3 x i32]]* %2 to i8*
%6 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 0, i64 0
%7 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 0, i64 1
%8 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 0, i64 2
%9 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %6, i32* %7, i32* %8)
%10 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 1, i64 0
%11 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 1, i64 1
%12 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 1, i64 2
%13 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %10, i32* %11, i32* %12)
%14 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 2, i64 0
%15 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 2, i64 1
%16 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 2, i64 2
%17 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %14, i32* %15, i32* %16)
%18 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 3, i64 0
%19 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 3, i64 1
%20 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 3, i64 2
%21 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %18, i32* %19, i32* %20)
%22 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 4, i64 0
%23 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 4, i64 1
%24 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 4, i64 2
%25 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %22, i32* %23, i32* %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%28 = load i32, i32* %1
%29 = load i32, i32* %6
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %41
31: ; preds = %50, %47, %44, %41, %0
%32 = phi i64 [ 0, %0 ], [ 1, %41 ], [ 2, %44 ], [ 3, %47 ], [ 4, %50 ]
%33 = phi i32* [ %6, %0 ], [ %10, %41 ], [ %14, %44 ], [ %18, %47 ], [ %22, %50 ]
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
%35 = load i32, i32* %33
%36 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 %32, i64 1
%37 = load i32, i32* %36
%38 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %2, i64 0, i64 %32, i64 2
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %35, i32 %37, i32 %39)
br label %55
41: ; preds = %0
%42 = load i32, i32* %10
%43 = icmp eq i32 %28, %42
br i1 %43, label %31, label %44
44: ; preds = %41
%45 = load i32, i32* %14
%46 = icmp eq i32 %28, %45
br i1 %46, label %31, label %47
47: ; preds = %44
%48 = load i32, i32* %18
%49 = icmp eq i32 %28, %48
br i1 %49, label %31, label %50
50: ; preds = %47
%51 = load i32, i32* %22
%52 = icmp eq i32 %28, %51
br i1 %52, label %31, label %53
53: ; preds = %50
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %55
55: ; preds = %53, %31
ret i32 0
}