#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 max(int, int);
int /*<<< orphan*/ printf(char *, ...);
void ifs() {
  printf("%d\n", max(10, 4));
  printf("%d\n", max(8, 9));
  printf("%d\n", max(0, 0));
  if (!(3 > 2)) {
    printf("this shouldn't print\n");
  }
  if (!(3 < 2)) {
    printf("yup!\n");
  }
  const char grade = 'A';
  switch (grade) {
  case 'A':
    printf("You did great!\n");
    break;
  case 'B':
    printf("You did alright!\n");
    break;
  case 'C':
    printf("You did poorly.\n");
    break;
  case 'D':
    printf("You did bad.\n");
  case 'F':
    printf("You failed!\n");
    break;
  default:
    printf("Invalid grade");
    break;
  }
}


x86 assembly (clang, -O0):
<ifs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
mov    $0x4,%esi
call   1040 <max@plt>
mov    %eax,%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x8,%edi
mov    $0x9,%esi
call   1040 <max@plt>
mov    %eax,%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <max@plt>
mov    %eax,%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x41,-0x1(%rbp)
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifs>:
push   %rbx
mov    $0xa,%edi
mov    $0x4,%esi
call   1050 <max@plt>
lea    0xeb9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x8,%edi
mov    $0x9,%esi
call   1050 <max@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <max@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe73(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [6 x i8] c"yup!\0A\00"
@.str.2 = [16 x i8] c"You did great!\0A\00"
define void @ifs() {
%1 = alloca i8
%2 = call i32 @max(i32 10, i32 4)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @max(i32 8, i32 9)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @max(i32 0, i32 0)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i8 65, i8* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@str = [5 x i8] c"yup!\00"
@str.3 = [15 x i8] c"You did great!\00"
define void @ifs() {
%1 = tail call i32 @max(i32 10, i32 4)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @max(i32 8, i32 9)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @max(i32 0, i32 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.3, i64 0, i64 0))
ret void
}