#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, ...);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
scalar_t__ strcmp(char *, char *);
main() {
  FILE *fp;
  FILE *fpd = 0;
  char issn[10], iname[21];
  float isal;
  int del;
  char ssn[10], name[21];
  float sal;
  int h;
  long off;
  int x;
  int i;
  int nrec;
  int j, z;
  int ovptr;
  int offr;
  int nov;
  fp = fopen("../create/emp", "r+");
  printf("Please enter SSN, name and salary separated by blanks\n");
  scanf("%s%s%f", issn, iname, &isal);
  for (x = i = 0; issn[i] != 0; i++) {
    x = x + issn[i];
  }
  h = x % 10;
  for (i = h; i != -1; i = ovptr) {
    off = i * (10L + 3 * (3 + 10 + 21 + 10 + 2));
    fseek(fp, off, 0);
    fscanf(fp, "%d%d", &nrec, &ovptr);
    for (j = 0; j < nrec; j++) {
      offr = ftell(fp) + 2;
      fscanf(fp, "%d%s%s%f", &del, ssn, name, &sal);
      if ((del == 0) && (strcmp(ssn, issn) == 0)) {
        printf("Error!!!SSN all ready Exist, aborting the insert.");
        fclose(fp);
        scanf("%d", &del);
        exit(1);
      }
      if (del == 1) {
        fpd = fopen("../create/emp", "r+");
        fseek(fpd, offr, 0);
      }
    }
  }
  if (fpd != 0) {
    fprintf(fpd, "%3d%10s%21s%10.2f\n", 0, issn, iname, isal);
    fclose(fpd);
  } else if (nrec < 3) {
    fseek(fp, 2L, 1);
    fprintf(fp, "%3d%10s%21s%10.2f\n", 0, issn, iname, isal);
    fseek(fp, off, 0);
    fprintf(fp, "%4d", ++nrec);
  } else {
    fpd = fopen("../create/over", "r+");
    fscanf(fpd, "%d", &nov);
    fseek(fp, off, 0);
    fprintf(fp, "%4d%4d\n", nrec, 10 + nov);
    fseek(fp, 0L, 2);
    fprintf(fp, "%4d%4d\n", 1, -1);
    fprintf(fp, "%3d%10s%21s%10.2f\n", 0, issn, iname, isal);
    for (z = 0; z < 2; z++) {
      fprintf(fp, "%3d%10s%21s%10.2f\n", -1, "x", "x", 0.0);
    }
    fseek(fpd, 0L, 0);
    fprintf(fpd, "%4d\n", ++nov);
    fclose(fpd);
  }
  fclose(fp);
  printf("Insert complete.\n");
  scanf("%d", &del);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe3f(%rip),%rdi
lea    0xe46(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
lea    -0x22(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    0xe63(%rip),%rdi
lea    -0x44(%rbp),%rcx
mov    $0x0,%al
call   10a0 <scanf@plt>
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x84(%rbp)
movslq -0x88(%rbp),%rax
movsbl -0x22(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     124e <main+0xae>
mov    -0x84(%rbp),%eax
movslq -0x88(%rbp),%rcx
movsbl -0x22(%rbp,%rcx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x84(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    120b <main+0x6b>
mov    -0x84(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x88(%rbp)
cmpl   $0xffffffff,-0x88(%rbp)
je     13ba <main+0x21a>
movslq -0x88(%rbp),%rax
imul   $0x94,%rax,%rax
mov    %rax,-0x80(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x80(%rbp),%rsi
xor    %edx,%edx
call   1090 <fseek@plt>
mov    -0x10(%rbp),%rdi
lea    0xda7(%rip),%rsi
lea    -0x8c(%rbp),%rdx
lea    -0x98(%rbp),%rcx
mov    $0x0,%al
call   1050 <fscanf@plt>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jge    13a4 <main+0x204>
mov    -0x10(%rbp),%rdi
call   1080 <ftell@plt>
add    $0x2,%eax
mov    %eax,-0x9c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x52(%rbp),%rcx
lea    -0x70(%rbp),%r8
lea    0xd56(%rip),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x74(%rbp),%r9
mov    $0x0,%al
call   1050 <fscanf@plt>
cmpl   $0x0,-0x48(%rbp)
jne    1358 <main+0x1b8>
lea    -0x52(%rbp),%rdi
lea    -0x22(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1358 <main+0x1b8>
lea    0xd28(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xd07(%rip),%rdi
lea    -0x48(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0x1,-0x48(%rbp)
jne    138b <main+0x1eb>
lea    0xc97(%rip),%rdi
lea    0xc9e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x9c(%rbp),%rsi
xor    %edx,%edx
call   1090 <fseek@plt>
jmp    1390 <main+0x1f0>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    12c0 <main+0x120>
jmp    13a9 <main+0x209>
mov    -0x98(%rbp),%eax
mov    %eax,-0x88(%rbp)
jmp    1268 <main+0xc8>
cmpq   $0x0,-0x18(%rbp)
je     13f8 <main+0x258>
mov    -0x18(%rbp),%rdi
lea    -0x22(%rbp),%rcx
lea    -0x40(%rbp),%r8
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xca7(%rip),%rsi
xor    %edx,%edx
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    15b2 <main+0x412>
cmpl   $0x3,-0x8c(%rbp)
jge    1472 <main+0x2d2>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1090 <fseek@plt>
mov    -0x10(%rbp),%rdi
lea    -0x22(%rbp),%rcx
lea    -0x40(%rbp),%r8
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc54(%rip),%rsi
xor    %edx,%edx
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x80(%rbp),%rsi
xor    %edx,%edx
call   1090 <fseek@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8c(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x8c(%rbp)
lea    0xc35(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    15ad <main+0x40d>
lea    0xc26(%rip),%rdi
lea    0xb8e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xbb6(%rip),%rsi
lea    -0xa0(%rbp),%rdx
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x80(%rbp),%rsi
xor    %edx,%edx
call   1090 <fseek@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8c(%rbp),%edx
mov    -0xa0(%rbp),%ecx
add    $0xa,%ecx
lea    0xbe3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2,%edx
call   1090 <fseek@plt>
mov    -0x10(%rbp),%rdi
lea    0xbbf(%rip),%rsi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x22(%rbp),%rcx
lea    -0x40(%rbp),%r8
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb6c(%rip),%rsi
xor    %edx,%edx
mov    $0x1,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x2,-0x94(%rbp)
jge    1574 <main+0x3d4>
mov    -0x10(%rbp),%rdi
lea    0xb41(%rip),%rsi
mov    $0xffffffff,%edx
lea    0xb63(%rip),%r8
xorps  %xmm0,%xmm0
mov    %r8,%rcx
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    152f <main+0x38f>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1090 <fseek@plt>
mov    -0x18(%rbp),%rdi
mov    -0xa0(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0xa0(%rbp)
lea    0xb14(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    15b2 <main+0x412>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xaf6(%rip),%rdi
call   1040 <printf@plt>
lea    0xa7c(%rip),%rdi
lea    -0x48(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xe3b(%rip),%rdi
lea    0xe42(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r15
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe31(%rip),%rdi
xor    %r14d,%r14d
lea    0x12(%rsp),%rsi
lea    0x30(%rsp),%rdx
lea    0xc(%rsp),%rcx
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x12(%rsp),%al
test   %al,%al
je     139b <main+0x1eb>
lea    0x13(%rsp),%rdx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%eax
add    %eax,%ecx
movzbl (%rdx),%eax
add    $0x1,%rdx
test   %al,%al
jne    1220 <main+0x70>
movslq %ecx,%r14
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r14d
cmp    $0xffffffff,%r14d
jne    139b <main+0x1eb>
lea    0xe08(%rip),%rdi
lea    0xda7(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0xd9d(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %edx,%edx
call   10a0 <fseek@plt>
mov    (%rsp),%edx
mov    0x8(%rsp),%ecx
add    $0xa,%ecx
lea    0xdd4(%rip),%rbp
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10a0 <fseek@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd6a(%rip),%r14
lea    0x12(%rsp),%rcx
lea    0x30(%rsp),%r8
mov    %r15,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    $0x1,%al
call   1080 <fprintf@plt>
lea    0xd78(%rip),%rbp
xorps  %xmm0,%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0xffffffff,%edx
mov    %rbp,%rcx
mov    %rbp,%r8
mov    $0x1,%al
call   1080 <fprintf@plt>
xorps  %xmm0,%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0xffffffff,%edx
mov    %rbp,%rcx
mov    %rbp,%r8
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <fseek@plt>
mov    0x8(%rsp),%edx
add    $0x1,%edx
mov    %edx,0x8(%rsp)
lea    0xd1f(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xd3b(%rip),%rdi
call   1030 <puts@plt>
lea    0xc8b(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
lea    0x46(%rsp),%rbp
lea    0x2c(%rsp),%r12
xor    %ebx,%ebx
jmp    13bf <main+0x20f>
nopl   0x0(%rax)
mov    0x1c(%rsp),%r14d
cmp    $0xffffffff,%r14d
je     14c8 <main+0x318>
movslq %r14d,%rax
imul   $0x94,%rax,%r14
mov    %r15,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   10a0 <fseek@plt>
mov    %r15,%rdi
lea    0xc31(%rip),%rsi
mov    %rsp,%rdx
lea    0x1c(%rsp),%rcx
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
mov    %r14,0x20(%rsp)
jle    13b0 <main+0x200>
xor    %r14d,%r14d
jmp    140c <main+0x25c>
add    $0x1,%r14d
mov    (%rsp),%eax
cmp    %eax,%r14d
jge    13b0 <main+0x200>
mov    %r15,%rdi
call   1090 <ftell@plt>
mov    %eax,%r13d
mov    %r15,%rdi
lea    0xbf5(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbp,%rcx
lea    0x50(%rsp),%r8
mov    %r12,%r9
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1450 <main+0x2a0>
cmp    $0x1,%eax
jne    1400 <main+0x250>
jmp    146b <main+0x2bb>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
lea    0x12(%rsp),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1497 <main+0x2e7>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
jne    1400 <main+0x250>
add    $0x2,%r13d
lea    0xb8a(%rip),%rdi
lea    0xb91(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
movslq %r13d,%rsi
mov    %rax,%rdi
xor    %edx,%edx
call   10a0 <fseek@plt>
jmp    1400 <main+0x250>
lea    0xb81(%rip),%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xb61(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
test   %rbx,%rbx
jne    1540 <main+0x390>
cmp    $0x2,%eax
mov    0x20(%rsp),%rbp
jg     1259 <main+0xa9>
mov    $0x2,%esi
mov    %r15,%rdi
mov    $0x1,%edx
call   10a0 <fseek@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb53(%rip),%rsi
lea    0x12(%rsp),%rcx
lea    0x30(%rsp),%r8
mov    %r15,%rdi
xor    %edx,%edx
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %edx,%edx
call   10a0 <fseek@plt>
mov    (%rsp),%edx
add    $0x1,%edx
mov    %edx,(%rsp)
lea    0xb33(%rip),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    136d <main+0x1bd>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb00(%rip),%rsi
lea    0x12(%rsp),%rcx
lea    0x30(%rsp),%r8
mov    %rbx,%rdi
xor    %edx,%edx
mov    $0x1,%al
call   1080 <fprintf@plt>
jmp    1365 <main+0x1b5>

LLVM IR (-O0):
@.str = [14 x i8] c"../create/emp\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [55 x i8] c"Please enter SSN, name and salary separated by blanks\0A\00"
@.str.3 = [7 x i8] c"%s%s%f\00"
@.str.4 = [5 x i8] c"%d%d\00"
@.str.5 = [9 x i8] c"%d%s%s%f\00"
@.str.6 = [50 x i8] c"Error!!!SSN all ready Exist, aborting the insert.\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [19 x i8] c"%3d%10s%21s%10.2f\0A\00"
@.str.9 = [4 x i8] c"%4d\00"
@.str.10 = [15 x i8] c"../create/over\00"
@.str.11 = [8 x i8] c"%4d%4d\0A\00"
@.str.12 = [2 x i8] c"x\00"
@.str.13 = [5 x i8] c"%4d\0A\00"
@.str.14 = [18 x i8] c"Insert complete.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [10 x i8]
%5 = alloca [21 x i8]
%6 = alloca float
%7 = alloca i32
%8 = alloca [10 x i8]
%9 = alloca [21 x i8]
%10 = alloca float
%11 = alloca i32
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %3
%21 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %2
%22 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %23, i8* %24, float* %6)
store i32 0, i32* %14
store i32 0, i32* %13
br label %26
26: ; preds = %41, %0
%27 = load i32, i32* %14
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %44
33: ; preds = %26
%34 = load i32, i32* %13
%35 = load i32, i32* %14
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = add nsw i32 %34, %39
store i32 %40, i32* %13
br label %41
41: ; preds = %33
%42 = load i32, i32* %14
%43 = add nsw i32 %42, 1
store i32 %43, i32* %14
br label %26
44: ; preds = %26
%45 = load i32, i32* %13
%46 = srem i32 %45, 10
store i32 %46, i32* %11
%47 = load i32, i32* %11
store i32 %47, i32* %14
br label %48
48: ; preds = %99, %44
%49 = load i32, i32* %14
%50 = icmp ne i32 %49, -1
br i1 %50, label %51, label %101
51: ; preds = %48
%52 = load i32, i32* %14
%53 = sext i32 %52 to i64
%54 = mul nsw i64 %53, 148
store i64 %54, i64* %12
%55 = load i32*, i32** %2
%56 = load i64, i64* %12
%57 = call i32 @fseek(i32* %55, i64 %56, i32 0)
%58 = load i32*, i32** %2
%59 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %15, i32* %18)
store i32 0, i32* %16
br label %60
60: ; preds = %95, %51
%61 = load i32, i32* %16
%62 = load i32, i32* %15
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %98
64: ; preds = %60
%65 = load i32*, i32** %2
%66 = call i32 @ftell(i32* %65)
%67 = add nsw i32 %66, 2
store i32 %67, i32* %19
%68 = load i32*, i32** %2
%69 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%70 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 0
%71 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %68, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %7, i8* %69, i8* %70, float* %10)
%72 = load i32, i32* %7
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %85
74: ; preds = %64
%75 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%76 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%77 = call i64 @strcmp(i8* %75, i8* %76)
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %85
79: ; preds = %74
%80 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%81 = load i32*, i32** %2
%82 = call i32 @fclose(i32* %81)
%83 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %7)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %74, %64
%86 = load i32, i32* %7
%87 = icmp eq i32 %86, 1
br i1 %87, label %88, label %94
88: ; preds = %85
%89 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %89, i32** %3
%90 = load i32*, i32** %3
%91 = load i32, i32* %19
%92 = sext i32 %91 to i64
%93 = call i32 @fseek(i32* %90, i64 %92, i32 0)
br label %94
94: ; preds = %88, %85
br label %95
95: ; preds = %94
%96 = load i32, i32* %16
%97 = add nsw i32 %96, 1
store i32 %97, i32* %16
br label %60
98: ; preds = %60
br label %99
99: ; preds = %98
%100 = load i32, i32* %18
store i32 %100, i32* %14
br label %48
101: ; preds = %48
%102 = load i32*, i32** %3
%103 = icmp ne i32* %102, null
br i1 %103, label %104, label %113
104: ; preds = %101
%105 = load i32*, i32** %3
%106 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%107 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%108 = load float, float* %6
%109 = fpext float %108 to double
%110 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 0, i8* %106, i8* %107, double %109)
%111 = load i32*, i32** %3
%112 = call i32 @fclose(i32* %111)
br label %173
113: ; preds = %101
%114 = load i32, i32* %15
%115 = icmp slt i32 %114, 3
br i1 %115, label %116, label %132
116: ; preds = %113
%117 = load i32*, i32** %2
%118 = call i32 @fseek(i32* %117, i64 2, i32 1)
%119 = load i32*, i32** %2
%120 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%121 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%122 = load float, float* %6
%123 = fpext float %122 to double
%124 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 0, i8* %120, i8* %121, double %123)
%125 = load i32*, i32** %2
%126 = load i64, i64* %12
%127 = call i32 @fseek(i32* %125, i64 %126, i32 0)
%128 = load i32*, i32** %2
%129 = load i32, i32* %15
%130 = add nsw i32 %129, 1
store i32 %130, i32* %15
%131 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %130)
br label %172
132: ; preds = %113
%133 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %133, i32** %3
%134 = load i32*, i32** %3
%135 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %20)
%136 = load i32*, i32** %2
%137 = load i64, i64* %12
%138 = call i32 @fseek(i32* %136, i64 %137, i32 0)
%139 = load i32*, i32** %2
%140 = load i32, i32* %15
%141 = load i32, i32* %20
%142 = add nsw i32 10, %141
%143 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %139, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32 %140, i32 %142)
%144 = load i32*, i32** %2
%145 = call i32 @fseek(i32* %144, i64 0, i32 2)
%146 = load i32*, i32** %2
%147 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %146, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 -1)
%148 = load i32*, i32** %2
%149 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%150 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%151 = load float, float* %6
%152 = fpext float %151 to double
%153 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %148, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 0, i8* %149, i8* %150, double %152)
store i32 0, i32* %17
br label %154
154: ; preds = %160, %132
%155 = load i32, i32* %17
%156 = icmp slt i32 %155, 2
br i1 %156, label %157, label %163
157: ; preds = %154
%158 = load i32*, i32** %2
%159 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %158, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), double 0.000000e+00)
br label %160
160: ; preds = %157
%161 = load i32, i32* %17
%162 = add nsw i32 %161, 1
store i32 %162, i32* %17
br label %154
163: ; preds = %154
%164 = load i32*, i32** %3
%165 = call i32 @fseek(i32* %164, i64 0, i32 0)
%166 = load i32*, i32** %3
%167 = load i32, i32* %20
%168 = add nsw i32 %167, 1
store i32 %168, i32* %20
%169 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %166, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %168)
%170 = load i32*, i32** %3
%171 = call i32 @fclose(i32* %170)
br label %172
172: ; preds = %163, %116
br label %173
173: ; preds = %172, %104
%174 = load i32*, i32** %2
%175 = call i32 @fclose(i32* %174)
%176 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0))
%177 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %7)
%178 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"../create/emp\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.3 = [7 x i8] c"%s%s%f\00"
@.str.4 = [5 x i8] c"%d%d\00"
@.str.5 = [9 x i8] c"%d%s%s%f\00"
@.str.6 = [50 x i8] c"Error!!!SSN all ready Exist, aborting the insert.\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [19 x i8] c"%3d%10s%21s%10.2f\0A\00"
@.str.9 = [4 x i8] c"%4d\00"
@.str.10 = [15 x i8] c"../create/over\00"
@.str.11 = [8 x i8] c"%4d%4d\0A\00"
@.str.12 = [2 x i8] c"x\00"
@.str.13 = [5 x i8] c"%4d\0A\00"
@str = [54 x i8] c"Please enter SSN, name and salary separated by blanks\00"
@str.15 = [17 x i8] c"Insert complete.\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [21 x i8]
%3 = alloca float
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = alloca [21 x i8]
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%12 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%13 = bitcast float* %3 to i8*
%14 = bitcast i32* %4 to i8*
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%17 = bitcast float* %7 to i8*
%18 = bitcast i32* %8 to i8*
%19 = bitcast i32* %9 to i8*
%20 = bitcast i32* %10 to i8*
%21 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %11, i8* %12, float* %3)
%24 = load i8, i8* %11
%25 = icmp eq i8 %24, 0
br i1 %25, label %39, label %26
26: ; preds = %0, %26
%27 = phi i64 [ %32, %26 ], [ 0, %0 ]
%28 = phi i8 [ %34, %26 ], [ %24, %0 ]
%29 = phi i32 [ %31, %26 ], [ 0, %0 ]
%30 = sext i8 %28 to i32
%31 = add nsw i32 %29, %30
%32 = add nuw nsw i64 %27, 1
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %36, label %26
36: ; preds = %26
%37 = srem i32 %31, 10
%38 = icmp eq i32 %37, -1
br i1 %38, label %103, label %39
39: ; preds = %0, %36
%40 = phi i32 [ %37, %36 ], [ 0, %0 ]
br label %41
41: ; preds = %39, %80
%42 = phi i32* [ %82, %80 ], [ null, %39 ]
%43 = phi i32 [ %83, %80 ], [ %40, %39 ]
%44 = sext i32 %43 to i64
%45 = mul nsw i64 %44, 148
%46 = call i32 @fseek(i32* %21, i64 %45, i32 0)
%47 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %8, i32* %9)
%48 = load i32, i32* %8
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %80
50: ; preds = %41, %75
%51 = phi i32* [ %76, %75 ], [ %42, %41 ]
%52 = phi i32 [ %77, %75 ], [ 0, %41 ]
%53 = call i32 @ftell(i32* %21)
%54 = add nsw i32 %53, 2
%55 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %4, i8* %15, i8* %16, float* %7)
%56 = load i32, i32* %4
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %68
58: ; preds = %50
%59 = call i64 @strcmp(i8* %15, i8* %11)
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %66
61: ; preds = %58
%62 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%63 = call i32 @fclose(i32* %21)
%64 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %58
%67 = load i32, i32* %4
br label %68
68: ; preds = %66, %50
%69 = phi i32 [ %67, %66 ], [ %56, %50 ]
%70 = icmp eq i32 %69, 1
br i1 %70, label %71, label %75
71: ; preds = %68
%72 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%73 = sext i32 %54 to i64
%74 = call i32 @fseek(i32* %72, i64 %73, i32 0)
br label %75
75: ; preds = %68, %71
%76 = phi i32* [ %72, %71 ], [ %51, %68 ]
%77 = add nuw nsw i32 %52, 1
%78 = load i32, i32* %8
%79 = icmp slt i32 %77, %78
br i1 %79, label %50, label %80
80: ; preds = %75, %41
%81 = phi i32 [ %48, %41 ], [ %78, %75 ]
%82 = phi i32* [ %42, %41 ], [ %76, %75 ]
%83 = load i32, i32* %9
%84 = icmp eq i32 %83, -1
br i1 %84, label %85, label %41
85: ; preds = %80
%86 = icmp eq i32* %82, null
br i1 %86, label %92, label %87
87: ; preds = %85
%88 = load float, float* %3
%89 = fpext float %88 to double
%90 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 0, i8* %11, i8* %12, double %89)
%91 = call i32 @fclose(i32* %82)
br label %124
92: ; preds = %85
%93 = icmp slt i32 %81, 3
br i1 %93, label %94, label %103
94: ; preds = %92
%95 = call i32 @fseek(i32* %21, i64 2, i32 1)
%96 = load float, float* %3
%97 = fpext float %96 to double
%98 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 0, i8* %11, i8* %12, double %97)
%99 = call i32 @fseek(i32* %21, i64 %45, i32 0)
%100 = load i32, i32* %8
%101 = add nsw i32 %100, 1
store i32 %101, i32* %8
%102 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %101)
br label %124
103: ; preds = %36, %92
%104 = phi i64 [ %45, %92 ], [ undef, %36 ]
%105 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%106 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %105, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %10)
%107 = call i32 @fseek(i32* %21, i64 %104, i32 0)
%108 = load i32, i32* %8
%109 = load i32, i32* %10
%110 = add nsw i32 %109, 10
%111 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32 %108, i32 %110)
%112 = call i32 @fseek(i32* %21, i64 0, i32 2)
%113 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 -1)
%114 = load float, float* %3
%115 = fpext float %114 to double
%116 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 0, i8* %11, i8* %12, double %115)
%117 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), double 0.000000e+00)
%118 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), double 0.000000e+00)
%119 = call i32 @fseek(i32* %105, i64 0, i32 0)
%120 = load i32, i32* %10
%121 = add nsw i32 %120, 1
store i32 %121, i32* %10
%122 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %121)
%123 = call i32 @fclose(i32* %105)
br label %124
124: ; preds = %94, %103, %87
%125 = call i32 @fclose(i32* %21)
%126 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.15, i64 0, i64 0))
%127 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%128 = call i32 @exit(i32 0)
unreachable
}