#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 *, ...);
int main() {
  float ans = 2;
  int test = 4;
  printf("Part 1, Compound Assignment!");
  ans += 7;
  printf("\n\n% .0f += %d evaluates to %.1f", (ans - 7), 7, ans);
  ans *= 7;
  printf("\n %.0f *= %d evaluates to %.1f", (ans / 7), 7, ans);
  ans -= 7;
  printf("\n %.0f -= %d evaluates to %.1f", (ans + 7), 7, ans);
  ans /= 7;
  printf("\n %.0f /= %d evaluates to %.1f", (ans * 7), 7, ans);
  test %= 7;
  printf("\n %d %= %d evaluates to %d", test, 7, test);
  int myValue = 5;
  printf("\n\nPart 2, Typecasting!!");
  printf("\n The value of (float)%d is %f", myValue, (float)myValue);
  printf("\n The value of (char)%d is %c", myValue, (char)myValue);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xedd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  0xeb7(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xea0(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xead(%rip),%rdi
mov    $0x7,%esi
mov    $0x2,%al
call   1030 <printf@plt>
movss  0xe74(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe5d(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe8a(%rip),%rdi
mov    $0x7,%esi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe2c(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe1b(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe66(%rip),%rdi
mov    $0x7,%esi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xde9(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xdd8(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe42(%rip),%rdi
mov    $0x7,%esi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%ecx
lea    0xe3a(%rip),%rdi
mov    $0x7,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x5,-0x10(%rbp)
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
cvtsi2ssl -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe39(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%eax
movsbl %al,%edx
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf18(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf27(%rip),%rdi
movsd  0xed2(%rip),%xmm0
movsd  0xed2(%rip),%xmm1
mov    $0x7,%esi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xf24(%rip),%rdi
movsd  0xebf(%rip),%xmm1
movsd  0xeaf(%rip),%xmm0
mov    $0x7,%esi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xf20(%rip),%rdi
movsd  0xea4(%rip),%xmm1
movsd  0xe94(%rip),%xmm0
mov    $0x7,%esi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xf1c(%rip),%rdi
movsd  0xe89(%rip),%xmm1
movsd  0xe79(%rip),%xmm0
mov    $0x7,%esi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
mov    $0x4,%esi
mov    $0x7,%edx
mov    $0x4,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf20(%rip),%rdi
movsd  0xe43(%rip),%xmm0
mov    $0x5,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf24(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Part 1, Compound Assignment!\00"
@.str.1 = [32 x i8] c"\0A\0A% .0f += %d evaluates to %.1f\00"
@.str.2 = [31 x i8] c"\0A %.0f *= %d evaluates to %.1f\00"
@.str.3 = [31 x i8] c"\0A %.0f -= %d evaluates to %.1f\00"
@.str.4 = [31 x i8] c"\0A %.0f /= %d evaluates to %.1f\00"
@.str.5 = [27 x i8] c"\0A %d %= %d evaluates to %d\00"
@.str.6 = [24 x i8] c"\0A\0APart 2, Typecasting!!\00"
@.str.7 = [31 x i8] c"\0A The value of (float)%d is %f\00"
@.str.8 = [30 x i8] c"\0A The value of (char)%d is %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store float 2.000000e+00, float* %2
store i32 4, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = load float, float* %2
%7 = fadd float %6, 7.000000e+00
store float %7, float* %2
%8 = load float, float* %2
%9 = fsub float %8, 7.000000e+00
%10 = fpext float %9 to double
%11 = load float, float* %2
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double %10, i32 7, double %12)
%14 = load float, float* %2
%15 = fmul float %14, 7.000000e+00
store float %15, float* %2
%16 = load float, float* %2
%17 = fdiv float %16, 7.000000e+00
%18 = fpext float %17 to double
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), double %18, i32 7, double %20)
%22 = load float, float* %2
%23 = fsub float %22, 7.000000e+00
store float %23, float* %2
%24 = load float, float* %2
%25 = fadd float %24, 7.000000e+00
%26 = fpext float %25 to double
%27 = load float, float* %2
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), double %26, i32 7, double %28)
%30 = load float, float* %2
%31 = fdiv float %30, 7.000000e+00
store float %31, float* %2
%32 = load float, float* %2
%33 = fmul float %32, 7.000000e+00
%34 = fpext float %33 to double
%35 = load float, float* %2
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), double %34, i32 7, double %36)
%38 = load i32, i32* %3
%39 = srem i32 %38, 7
store i32 %39, i32* %3
%40 = load i32, i32* %3
%41 = load i32, i32* %3
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %40, i32 7, i32 %41)
store i32 5, i32* %4
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%44 = load i32, i32* %4
%45 = load i32, i32* %4
%46 = sitofp i32 %45 to float
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %44, double %47)
%49 = load i32, i32* %4
%50 = load i32, i32* %4
%51 = trunc i32 %50 to i8
%52 = sext i8 %51 to i32
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 %49, i32 %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Part 1, Compound Assignment!\00"
@.str.1 = [32 x i8] c"\0A\0A% .0f += %d evaluates to %.1f\00"
@.str.2 = [31 x i8] c"\0A %.0f *= %d evaluates to %.1f\00"
@.str.3 = [31 x i8] c"\0A %.0f -= %d evaluates to %.1f\00"
@.str.4 = [31 x i8] c"\0A %.0f /= %d evaluates to %.1f\00"
@.str.5 = [27 x i8] c"\0A %d %= %d evaluates to %d\00"
@.str.6 = [24 x i8] c"\0A\0APart 2, Typecasting!!\00"
@.str.7 = [31 x i8] c"\0A The value of (float)%d is %f\00"
@.str.8 = [30 x i8] c"\0A The value of (char)%d is %c\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double 2.000000e+00, i32 7, double 9.000000e+00)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), double 9.000000e+00, i32 7, double 6.300000e+01)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), double 6.300000e+01, i32 7, double 5.600000e+01)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), double 5.600000e+01, i32 7, double 8.000000e+00)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 4, i32 7, i32 4)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 5, double 5.000000e+00)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 5, i32 5)
ret i32 0
}