#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int i, j;
  char name, garbage;
  int count;
  char style[4][2];
  FILE *fp;
  fp = fopen("auxprop.txt", "w");
  fprintf(fp, "\n");
  for (i = 0; i < 16; i++) {
    scanf("%c", &garbage);
    printf("\nRound %d:\n\n Enter Name:\n", i);
    scanf("%c", &name);
    fprintf(fp, "patternMS[%d].name='%c';\n", i, name);
    printf("\nFor %c Enter Count:\n", name);
    scanf("%d", &count);
    fprintf(fp, "patternMS[%d].count=%d;\n", i, count);
    for (j = 0; j < count; j++) {
      printf("\nEnter style %d:\n", j);
      scanf("%s", style[j]);
      fprintf(fp, "patternMS[%d].bits[%d]=%s;\n", i, j, style[j]);
    }
    fprintf(fp, "\n");
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xf06(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    12b3 <main+0x163>
lea    0xe6e(%rip),%rdi
lea    -0xe(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe4d(%rip),%rdi
lea    -0xd(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%edx
movsbl -0xd(%rbp),%ecx
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movsbl -0xd(%rbp),%esi
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1293 <main+0x143>
mov    -0xc(%rbp),%esi
lea    0xe3b(%rip),%rdi
call   1040 <printf@plt>
movslq -0xc(%rbp),%rax
lea    -0x1c(%rbp),%rsi
shl    $0x1,%rax
add    %rax,%rsi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
movslq -0xc(%rbp),%rax
lea    -0x1c(%rbp),%r8
shl    $0x1,%rax
add    %rax,%r8
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1226 <main+0xd6>
mov    -0x28(%rbp),%rdi
lea    0xde9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118f <main+0x3f>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe8b(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    $0xa,%edi
mov    %rax,%rsi
call   1050 <fputc@plt>
xor    %ebp,%ebp
jmp    11bc <main+0x5c>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
add    $0x1,%ebp
cmp    $0x10,%ebp
mov    %r12,%rbx
je     12b8 <main+0x158>
lea    0xe4b(%rip),%r14
mov    %r14,%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe38(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
lea    0x7(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
movsbl 0x7(%rsp),%ecx
mov    %rbx,%rdi
lea    0xe2d(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
movsbl 0x7(%rsp),%esi
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
lea    0xe3c(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
lea    0xe25(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
cmpl   $0x0,0x8(%rsp)
lea    0xe29(%rip),%r13
mov    %rbx,%r12
lea    0xe34(%rip),%rbx
jle    11a0 <main+0x40>
lea    0x10(%rsp),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
lea    0xe07(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14,%r8
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x1,%r15
movslq 0x8(%rsp),%rax
add    $0x2,%r14
cmp    %rax,%r15
jl     1270 <main+0x110>
jmp    11a0 <main+0x40>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"auxprop.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [26 x i8] c"\0ARound %d:\0A\0A Enter Name:\0A\00"
@.str.5 = [26 x i8] c"patternMS[%d].name='%c';\0A\00"
@.str.6 = [22 x i8] c"\0AFor %c Enter Count:\0A\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [25 x i8] c"patternMS[%d].count=%d;\0A\00"
@.str.9 = [18 x i8] c"\0AEnter style %d:\0A\00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [28 x i8] c"patternMS[%d].bits[%d]=%s;\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
%7 = alloca [4 x [2 x i8]]
%8 = alloca i32*
store i32 0, i32* %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %8
%10 = load i32*, i32** %8
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %12
12: ; preds = %59, %0
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 16
br i1 %14, label %15, label %62
15: ; preds = %12
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%20 = load i32*, i32** %8
%21 = load i32, i32* %2
%22 = load i8, i8* %4
%23 = sext i8 %22 to i32
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %21, i32 %23)
%25 = load i8, i8* %4
%26 = sext i8 %25 to i32
%27 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %6)
%29 = load i32*, i32** %8
%30 = load i32, i32* %2
%31 = load i32, i32* %6
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %30, i32 %31)
store i32 0, i32* %3
br label %33
33: ; preds = %53, %15
%34 = load i32, i32* %3
%35 = load i32, i32* %6
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %56
37: ; preds = %33
%38 = load i32, i32* %3
%39 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [4 x [2 x i8]], [4 x [2 x i8]]* %7, i64 0, i64 %41
%43 = getelementptr inbounds [2 x i8], [2 x i8]* %42, i64 0, i64 0
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %43)
%45 = load i32*, i32** %8
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [4 x [2 x i8]], [4 x [2 x i8]]* %7, i64 0, i64 %49
%51 = getelementptr inbounds [2 x i8], [2 x i8]* %50, i64 0, i64 0
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %46, i32 %47, i8* %51)
br label %53
53: ; preds = %37
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %33
56: ; preds = %33
%57 = load i32*, i32** %8
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %59
59: ; preds = %56
%60 = load i32, i32* %2
%61 = add nsw i32 %60, 1
store i32 %61, i32* %2
br label %12
62: ; preds = %12
%63 = load i32*, i32** %8
%64 = call i32 @fclose(i32* %63)
%65 = load i32, i32* %1
ret i32 %65
}

LLVM IR (-O2):
@.str = [12 x i8] c"auxprop.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [26 x i8] c"\0ARound %d:\0A\0A Enter Name:\0A\00"
@.str.5 = [26 x i8] c"patternMS[%d].name='%c';\0A\00"
@.str.6 = [22 x i8] c"\0AFor %c Enter Count:\0A\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [25 x i8] c"patternMS[%d].count=%d;\0A\00"
@.str.9 = [18 x i8] c"\0AEnter style %d:\0A\00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [28 x i8] c"patternMS[%d].bits[%d]=%s;\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i32
%4 = alloca [4 x [2 x i8]]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [4 x [2 x i8]], [4 x [2 x i8]]* %4, i64 0, i64 0, i64 0
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @fputc(i32 10, i32* %7)
br label %9
9: ; preds = %0, %36
%10 = phi i32 [ 0, %0 ], [ %38, %36 ]
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%14 = load i8, i8* %1
%15 = sext i8 %14 to i32
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %10, i32 %15)
%17 = load i8, i8* %1
%18 = sext i8 %17 to i32
%19 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %18)
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %3
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %10, i32 %21)
%23 = load i32, i32* %3
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %36
25: ; preds = %9, %25
%26 = phi i64 [ %32, %25 ], [ 0, %9 ]
%27 = trunc i64 %26 to i32
%28 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [4 x [2 x i8]], [4 x [2 x i8]]* %4, i64 0, i64 %26, i64 0
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %29)
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %10, i32 %27, i8* %29)
%32 = add nuw nsw i64 %26, 1
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %32, %34
br i1 %35, label %25, label %36
36: ; preds = %25, %9
%37 = call i32 @fputc(i32 10, i32* %7)
%38 = add nuw nsw i32 %10, 1
%39 = icmp eq i32 %38, 16
br i1 %39, label %40, label %9
40: ; preds = %36
%41 = call i32 @fclose(i32* %7)
ret i32 0
}