#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 *, ...);
void main() {
  int y = 100;
  printf("Integer y is equal to %d\n", y);
  printf("Error Type: Syntactic\n\n");
  int x = 10;
  printf("Half of %.0f is %.0f\n", (float)x, (float)x * (1.0 / 2));
  printf("Error Type: Contextual \n\n");
  x = 10;
  if (x == 20) {
    printf("x is equal to 20.\n");
  }
  if (x > 20) {
    printf("x is greater than 20.\n");
  } else {
    printf("x is less than 20.\n");
  }
  printf("Error Type: Semantic \n\n");
  x = 10;
  if (x % 2 == 0) {
    printf("%d is an even number.\n", x);
  }
  if (x % 2 != 0) {
    printf("%d is an odd number.\n", x);
  }
  printf("Error Type: Semantic \n\n");
  printf("Hello %s\n", "World!");
  printf("Error Type: Contextual \n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x8(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xea1(%rip),%xmm2
mulsd  %xmm2,%xmm1
lea    0xed0(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jne    119e <main+0x8e>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x14,-0x8(%rbp)
jle    11bb <main+0xab>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c9 <main+0xb9>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1203 <main+0xf3>
mov    -0x8(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1228 <main+0x118>
mov    -0x8(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
movsd  0xeae(%rip),%xmm0
movsd  0xeae(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xf41(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0f(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeaa(%rip),%rdi
lea    0xead(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Integer y is equal to %d\0A\00"
@.str.1 = [24 x i8] c"Error Type: Syntactic\0A\0A\00"
@.str.2 = [22 x i8] c"Half of %.0f is %.0f\0A\00"
@.str.3 = [26 x i8] c"Error Type: Contextual \0A\0A\00"
@.str.4 = [19 x i8] c"x is equal to 20.\0A\00"
@.str.5 = [23 x i8] c"x is greater than 20.\0A\00"
@.str.6 = [20 x i8] c"x is less than 20.\0A\00"
@.str.7 = [24 x i8] c"Error Type: Semantic \0A\0A\00"
@.str.8 = [23 x i8] c"%d is an even number.\0A\00"
@.str.9 = [22 x i8] c"%d is an odd number.\0A\00"
@.str.10 = [10 x i8] c"Hello %s\0A\00"
@.str.11 = [7 x i8] c"World!\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 100, i32* %1
%3 = load i32, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 10, i32* %2
%6 = load i32, i32* %2
%7 = sitofp i32 %6 to float
%8 = fpext float %7 to double
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to float
%11 = fpext float %10 to double
%12 = fmul double %11, 5.000000e-01
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %8, double %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 10, i32* %2
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 20
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %0
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 20
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %26
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
store i32 10, i32* %2
%28 = load i32, i32* %2
%29 = srem i32 %28, 2
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = load i32, i32* %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %26
%35 = load i32, i32* %2
%36 = srem i32 %35, 2
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i32, i32* %2
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %38, %34
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Integer y is equal to %d\0A\00"
@.str.2 = [22 x i8] c"Half of %.0f is %.0f\0A\00"
@.str.8 = [23 x i8] c"%d is an even number.\0A\00"
@.str.10 = [10 x i8] c"Hello %s\0A\00"
@.str.11 = [7 x i8] c"World!\00"
@str = [23 x i8] c"Error Type: Syntactic\0A\00"
@str.13 = [19 x i8] c"x is less than 20.\00"
@str.15 = [23 x i8] c"Error Type: Semantic \0A\00"
@str.16 = [25 x i8] c"Error Type: Contextual \0A\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 100)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double 1.000000e+01, double 5.000000e+00)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.16, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 10)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.16, i64 0, i64 0))
ret void
}