#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 */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
char *rounding_to_string(int r) {
  char *buf = malloc(32);
  if (r == 0) {
    strcpy(buf, "Correct");
  } else if (r < 0) {
    strcpy(buf, "Lower");
  } else {
    strcpy(buf, "Greater");
  }
  return buf;
}


x86 assembly (clang, -O0):
<rounding_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x20,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1158 <rounding_to_string+0x38>
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    118c <rounding_to_string+0x6c>
cmpl   $0x0,-0x4(%rbp)
jge    1177 <rounding_to_string+0x57>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1187 <rounding_to_string+0x67>
mov    -0x10(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    118c <rounding_to_string+0x6c>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rounding_to_string>:
push   %rbx
mov    %edi,%ebx
mov    $0x20,%edi
call   1040 <malloc@plt>
test   %ebx,%ebx
lea    0xed2(%rip),%rcx
lea    0xed1(%rip),%rdx
cmovs  %rcx,%rdx
mov    %rax,%rbx
lea    0xeb5(%rip),%rsi
cmovne %rdx,%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Correct\00"
@.str.1 = [6 x i8] c"Lower\00"
@.str.2 = [8 x i8] c"Greater\00"
define i8* @rounding_to_string(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* @malloc(i32 32)
store i8* %4, i8** %3
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %20
10: ; preds = %1
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %19
16: ; preds = %10
%17 = load i8*, i8** %3
%18 = call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %16, %13
br label %20
20: ; preds = %19, %7
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@.str = [8 x i8] c"Correct\00"
@.str.1 = [6 x i8] c"Lower\00"
@.str.2 = [8 x i8] c"Greater\00"
define i8* @rounding_to_string(i32 %0) {
%2 = tail call dereferenceable_or_null(32) i8* @malloc(i32 32)
%3 = icmp eq i32 %0, 0
%4 = icmp slt i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%6 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5
%7 = tail call i32 @strcpy(i8* %2, i8* %6)
ret i8* %2
}