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

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void print_image(FILE *fptr) {
  char read_geniass[1024];
  while (fgets(read_geniass, sizeof(read_geniass), fptr) != NULL)
    printf("%s", read_geniass);
  printf("Please enter an option: \n");
  printf("\x1B[32m"
         " [*] Enter '1' for items to be brought by you.\n [*] Enter '2' to "
         "view the timetable for the event.\n [*] Enter '3' to view the rules "
         "and guidelines for the event."
         "\033[0m");
  printf("\n");
  int option;
  printf("Option: ");
  scanf("%d", &option);
  if (option == 1) {
    printf("[*] For the Hackathon, you will be expected to bring the following "
           "items:\n");
    printf("1. Laptops\n2. Smartphones\n3. Chargers\n4. Internet Dongle\n5. "
           "Ideas\n6. A backpack\n7. Headphones\n8. Extension board\n9. "
           "Notebook & Pen\n10. Flash Drives\n");
  } else if (option == 2) {
    printf("[*] The timings for the programme will be as follows:\n");
    printf("0700 to 0800 hours    Schools arrive.\n0800 hours            "
           "Registration closes\n0800 to 0825 hours    Prinicipal's "
           "Keynote\n0830 to 1230 hours   Coding.\n1230 hours            Lunch "
           "will be available.\n1230 to 1800 hours    Coding.\n1800 hours "
           "onwards    Judging begins.\n");
  } else if (option == 3) {
    printf("[*] The rules for the programme are:\n");
    printf("\n1. You can have a maximum of 5 members in a team.");
    printf(
        "\n2. To ensure a level field for all contestants, all code, design, "
        "art, music and assets MUST be created during the duration of the "
        "Hackathon. \n   We want to ensure that all participants start off on "
        "the same footing and we also want \n   to preserve the true nature of "
        "a hackathon. The only exception to this rule would include material "
        "that is freely available to the public like\n");
    printf("   Creative Commons Images and third party apis.");
    printf("\n3. Winning submissions may be subject to code review.");
    printf(
        "\n   Be kind to others. Do not insult or put down other attendees. "
        "Behave professionally. Remember that harassment and racist, sexist, "
        "or exclusionary \n   jokes are not appropriate for this event.");
    printf(
        "\n   Hack, meet new people, get creative, and have a good time. "
        "Getting something meaningful done within such a short amount of time "
        "can be stressful, \n   but we'd like to encourage everyone to take a "
        "break every now and then to relax and enjoy the event.\n \r");
  }
}


x86 assembly (clang, -O0):
<print_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1178 <print_image+0x48>
lea    -0x410(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <print_image+0xf>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1a(%rip),%rdi
lea    -0x414(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x414(%rbp)
jne    11f1 <print_image+0xc1>
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1298 <print_image+0x168>
cmpl   $0x2,-0x414(%rbp)
jne    121f <print_image+0xef>
lea    0xfaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1293 <print_image+0x163>
cmpl   $0x3,-0x414(%rbp)
jne    128e <print_image+0x15e>
lea    0x10c4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x10dc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1101(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1271(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1294(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x12bd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1373(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1293 <print_image+0x163>
jmp    1298 <print_image+0x168>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_image>:
push   %r15
push   %r14
push   %rbx
sub    $0x410,%rsp
mov    %rdi,%r15
lea    0x10(%rsp),%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11b2 <print_image+0x62>
lea    0xe83(%rip),%r14
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    1190 <print_image+0x40>
lea    0x1162(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x3,%eax
je     1221 <print_image+0xd1>
cmp    $0x2,%eax
je     1281 <print_image+0x131>
cmp    $0x1,%eax
jne    1299 <print_image+0x149>
lea    0x1404(%rip),%rdi
call   1040 <puts@plt>
lea    0x1442(%rip),%rdi
jmp    1294 <print_image+0x144>
lea    0x110c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1117(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeeb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xfa1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1299 <print_image+0x149>
lea    0x124e(%rip),%rdi
call   1040 <puts@plt>
lea    0x1278(%rip),%rdi
call   1040 <puts@plt>
add    $0x410,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [26 x i8] c"Please enter an option: \0A\00"
@.str.2 = [171 x i8] c"\1B[32m [*] Enter '1' for items to be brought by you.\0A [*] Enter '2' to view the timetable for the event.\0A [*] Enter '3' to view the rules and guidelines for the event.\1B[0m\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [9 x i8] c"Option: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [75 x i8] c"[*] For the Hackathon, you will be expected to bring the following items:\0A\00"
@.str.7 = [149 x i8] c"1. Laptops\0A2. Smartphones\0A3. Chargers\0A4. Internet Dongle\0A5. Ideas\0A6. A backpack\0A7. Headphones\0A8. Extension board\0A9. Notebook & Pen\0A10. Flash Drives\0A\00"
@.str.8 = [55 x i8] c"[*] The timings for the programme will be as follows:\0A\00"
@.str.9 = [268 x i8] c"0700 to 0800 hours Schools arrive.\0A0800 hours Registration closes\0A0800 to 0825 hours Prinicipal's Keynote\0A0830 to 1230 hours Coding.\0A1230 hours Lunch will be available.\0A1230 to 1800 hours Coding.\0A1800 hours onwards Judging begins.\0A\00"
@.str.10 = [38 x i8] c"[*] The rules for the programme are:\0A\00"
@.str.11 = [51 x i8] c"\0A1. You can have a maximum of 5 members in a team.\00"
@.str.12 = [382 x i8] c"\0A2. To ensure a level field for all contestants, all code, design, art, music and assets MUST be created during the duration of the Hackathon. \0A We want to ensure that all participants start off on the same footing and we also want \0A to preserve the true nature of a hackathon. The only exception to this rule would include material that is freely available to the public like\0A\00"
@.str.13 = [49 x i8] c" Creative Commons Images and third party apis.\00"
@.str.14 = [55 x i8] c"\0A3. Winning submissions may be subject to code review.\00"
@.str.15 = [196 x i8] c"\0A Be kind to others. Do not insult or put down other attendees. Behave professionally. Remember that harassment and racist, sexist, or exclusionary \0A jokes are not appropriate for this event.\00"
@.str.16 = [258 x i8] c"\0A Hack, meet new people, get creative, and have a good time. Getting something meaningful done within such a short amount of time can be stressful, \0A but we'd like to encourage everyone to take a break every now and then to relax and enjoy the event.\0A \0D\00"
define void @print_image(i32* %0) {
%2 = alloca i32*
%3 = alloca [1024 x i8]
%4 = alloca i32
store i32* %0, i32** %2
br label %5
5: ; preds = %10, %1
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = load i32*, i32** %2
%8 = call i32* @fgets(i8* %6, i32 1024, i32* %7)
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %5
13: ; preds = %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %13
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.7, i64 0, i64 0))
br label %43
24: ; preds = %13
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([268 x i8], [268 x i8]* @.str.9, i64 0, i64 0))
br label %42
30: ; preds = %24
%31 = load i32, i32* %4
%32 = icmp eq i32 %31, 3
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.11, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([382 x i8], [382 x i8]* @.str.12, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.14, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([196 x i8], [196 x i8]* @.str.15, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([258 x i8], [258 x i8]* @.str.16, i64 0, i64 0))
br label %41
41: ; preds = %33, %30
br label %42
42: ; preds = %41, %27
br label %43
43: ; preds = %42, %21
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.2 = [171 x i8] c"\1B[32m [*] Enter '1' for items to be brought by you.\0A [*] Enter '2' to view the timetable for the event.\0A [*] Enter '3' to view the rules and guidelines for the event.\1B[0m\00"
@.str.4 = [9 x i8] c"Option: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.11 = [51 x i8] c"\0A1. You can have a maximum of 5 members in a team.\00"
@.str.13 = [49 x i8] c" Creative Commons Images and third party apis.\00"
@.str.14 = [55 x i8] c"\0A3. Winning submissions may be subject to code review.\00"
@.str.15 = [196 x i8] c"\0A Be kind to others. Do not insult or put down other attendees. Behave professionally. Remember that harassment and racist, sexist, or exclusionary \0A jokes are not appropriate for this event.\00"
@.str.16 = [258 x i8] c"\0A Hack, meet new people, get creative, and have a good time. Getting something meaningful done within such a short amount of time can be stressful, \0A but we'd like to encourage everyone to take a break every now and then to relax and enjoy the event.\0A \0D\00"
@str = [25 x i8] c"Please enter an option: \00"
@str.17 = [37 x i8] c"[*] The rules for the programme are:\00"
@str.18 = [381 x i8] c"\0A2. To ensure a level field for all contestants, all code, design, art, music and assets MUST be created during the duration of the Hackathon. \0A We want to ensure that all participants start off on the same footing and we also want \0A to preserve the true nature of a hackathon. The only exception to this rule would include material that is freely available to the public like\00"
@str.19 = [54 x i8] c"[*] The timings for the programme will be as follows:\00"
@str.20 = [267 x i8] c"0700 to 0800 hours Schools arrive.\0A0800 hours Registration closes\0A0800 to 0825 hours Prinicipal's Keynote\0A0830 to 1230 hours Coding.\0A1230 hours Lunch will be available.\0A1230 to 1800 hours Coding.\0A1800 hours onwards Judging begins.\00"
@str.21 = [74 x i8] c"[*] For the Hackathon, you will be expected to bring the following items:\00"
@str.22 = [148 x i8] c"1. Laptops\0A2. Smartphones\0A3. Chargers\0A4. Internet Dongle\0A5. Ideas\0A6. A backpack\0A7. Headphones\0A8. Extension board\0A9. Notebook & Pen\0A10. Flash Drives\00"
define void @print_image(i32* nocapture %0) {
%2 = alloca [1024 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%6 = icmp eq i32* %5, null
br i1 %6, label %11, label %7
7: ; preds = %1, %7
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %7
11: ; preds = %7, %1
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([171 x i8], [171 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @putchar(i32 10)
%15 = bitcast i32* %3 to i8*
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
switch i32 %18, label %33 [
i32 1, label %19
i32 2, label %22
i32 3, label %25
]
19: ; preds = %11
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.21, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([148 x i8], [148 x i8]* @str.22, i64 0, i64 0))
br label %33
22: ; preds = %11
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.19, i64 0, i64 0))
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([267 x i8], [267 x i8]* @str.20, i64 0, i64 0))
br label %33
25: ; preds = %11
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.17, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.11, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([381 x i8], [381 x i8]* @str.18, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.14, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([196 x i8], [196 x i8]* @.str.15, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([258 x i8], [258 x i8]* @.str.16, i64 0, i64 0))
br label %33
33: ; preds = %11, %22, %25, %19
ret void
}