xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int erro(const char *str) {
  fprintf(stderr, "** erro: %s\n", str);
  return -1;
}


x86 assembly (clang, -O0):
<erro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erro>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"** erro: %s\0A\00"
define i32 @erro(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 -1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"** erro: %s\0A\00"
define i32 @erro(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 -1
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int32_t round_shift(int32_t value, int bit) {
  assert(bit >= 1);
  return (value + (1 << (bit - 1))) >> bit;
}


x86 assembly (clang, -O0):
<round_shift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_shift>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
test   %esi,%esi
setg   %dil
call   1030 <assert@plt>
lea    -0x1(%rbx),%ecx
mov    $0x1,%eax
shl    %cl,%eax
add    %ebp,%eax
mov    %ebx,%ecx
sar    %cl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @round_shift(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sge i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
%12 = shl i32 1, %11
%13 = add nsw i32 %9, %12
%14 = load i32, i32* %4
%15 = ashr i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @round_shift(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = add nsw i32 %1, -1
%7 = shl nuw i32 1, %6
%8 = add nsw i32 %7, %0
%9 = ashr i32 %8, %1
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ Cmd_RemoveCommand(char *);
void SV_RemoveDedicatedCommands(void) {
  Cmd_RemoveCommand("serverinfo");
  Cmd_RemoveCommand("systeminfo");
  Cmd_RemoveCommand("tell");
  Cmd_RemoveCommand("say");
  Cmd_RemoveCommand("locations");
}


x86 assembly (clang, -O0):
<SV_RemoveDedicatedCommands>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
lea    0xee4(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
lea    0xee3(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
lea    0xedc(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
lea    0xed4(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SV_RemoveDedicatedCommands>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
lea    0xee7(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
lea    0xee6(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
lea    0xedf(%rip),%rdi
call   1030 <Cmd_RemoveCommand@plt>
lea    0xed7(%rip),%rdi
pop    %rax
jmp    1030 <Cmd_RemoveCommand@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"serverinfo\00"
@.str.1 = [11 x i8] c"systeminfo\00"
@.str.2 = [5 x i8] c"tell\00"
@.str.3 = [4 x i8] c"say\00"
@.str.4 = [10 x i8] c"locations\00"
define void @SV_RemoveDedicatedCommands() {
%1 = call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"serverinfo\00"
@.str.1 = [11 x i8] c"systeminfo\00"
@.str.2 = [5 x i8] c"tell\00"
@.str.3 = [4 x i8] c"say\00"
@.str.4 = [10 x i8] c"locations\00"
define void @SV_RemoveDedicatedCommands() {
%1 = tail call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @Cmd_RemoveCommand(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  puts("Hello world!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
unsigned short ntohs(unsigned short);
unsigned short convertUShort(char *s) {
  unsigned short *p = (unsigned short *)s;
  return ntohs(*p);
}


x86 assembly (clang, -O0):
<convertUShort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzwl (%rax),%edi
call   1030 <ntohs@plt>
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertUShort>:
movzwl (%rdi),%edi
jmp    1030 <ntohs@plt>

LLVM IR (-O0):
define zeroext i16 @convertUShort(i8* %0) {
%2 = alloca i8*
%3 = alloca i16*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i16*
store i16* %5, i16** %3
%6 = load i16*, i16** %3
%7 = load i16, i16* %6
%8 = call zeroext i16 @ntohs(i16 zeroext %7)
ret i16 %8
}

LLVM IR (-O2):
define zeroext i16 @convertUShort(i8* nocapture %0) {
%2 = bitcast i8* %0 to i16*
%3 = load i16, i16* %2
%4 = tail call zeroext i16 @ntohs(i16 zeroext %3)
ret i16 %4
}
/* Variables and functions */
int /*<<< orphan*/ function1();
void function2() {
  int i, j;
  function1();
  for (i = 0; i < 20000; i++)
    j = i;
}


x86 assembly (clang, -O0):
<function2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <function1@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4e20,-0x4(%rbp)
jge    1147 <function2+0x37>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <function2+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function2>:
xor    %eax,%eax
jmp    1030 <function1@plt>

LLVM IR (-O0):
define void @function2() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @function1()
store i32 0, i32* %1
br label %4
4: ; preds = %9, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 20000
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %1
store i32 %8, i32* %2
br label %9
9: ; preds = %7
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
br label %4
12: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @function2() {
%1 = tail call i32 (...) @function1()
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
#define TIME_UTC 128
int clock_gettime(int /*<<< orphan*/, struct timespec *);
int timespec_get(struct timespec *ts, int base) {
  switch (base) {
  case TIME_UTC:
    if (clock_gettime(CLOCK_REALTIME, ts) == -1)
      return 0;
    break;
  default:
    return 0;
  }
  return base;
}


x86 assembly (clang, -O0):
<timespec_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
jne    115e <timespec_get+0x4e>
jmp    1132 <timespec_get+0x22>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    1159 <timespec_get+0x49>
movl   $0x0,-0x4(%rbp)
jmp    1170 <timespec_get+0x60>
jmp    116a <timespec_get+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1170 <timespec_get+0x60>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec_get>:
xor    %eax,%eax
cmp    $0x80,%esi
jne    1140 <timespec_get+0x30>
push   %rax
mov    %rdi,%rcx
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
mov    %rcx,%rsi
call   1030 <clock_gettime@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
setne  %al
shl    $0x7,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @timespec_get(%struct.timespec* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
%5 = alloca i32
store %struct.timespec* %0, %struct.timespec** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %14 [
i32 128, label %7
]
7: ; preds = %2
%8 = load i32, i32* @CLOCK_REALTIME
%9 = load %struct.timespec*, %struct.timespec** %4
%10 = call i32 @clock_gettime(i32 %8, %struct.timespec* %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %7
store i32 0, i32* %3
br label %17
13: ; preds = %7
br label %15
14: ; preds = %2
store i32 0, i32* %3
br label %17
15: ; preds = %13
%16 = load i32, i32* %5
store i32 %16, i32* %3
br label %17
17: ; preds = %15, %14, %12
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @timespec_get(%struct.timespec* %0, i32 %1) {
%3 = icmp eq i32 %1, 128
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @CLOCK_REALTIME
%6 = tail call i32 @clock_gettime(i32 %5, %struct.timespec* %0)
%7 = icmp eq i32 %6, -1
%8 = select i1 %7, i32 0, i32 128
br label %9
9: ; preds = %2, %4
%10 = phi i32 [ %8, %4 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int xingheader_file_make3(char *, int /*<<< orphan*/, int);
int xingheader_file_make(char *file) {
  return xingheader_file_make3(file, 0, 44100);
}


x86 assembly (clang, -O0):
<xingheader_file_make>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xac44,%edx
call   1030 <xingheader_file_make3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xingheader_file_make>:
xor    %esi,%esi
mov    $0xac44,%edx
jmp    1030 <xingheader_file_make3@plt>

LLVM IR (-O0):
define i32 @xingheader_file_make(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @xingheader_file_make3(i8* %3, i32 0, i32 44100)
ret i32 %4
}

LLVM IR (-O2):
define i32 @xingheader_file_make(i8* %0) {
%2 = tail call i32 @xingheader_file_make3(i8* %0, i32 0, i32 44100)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ glVertex3f(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/);
void Vertex3f(GLfloat x, GLfloat y, GLfloat z) { glVertex3f(x, y, z); }


x86 assembly (clang, -O0):
<Vertex3f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <glVertex3f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vertex3f>:
jmp    1030 <glVertex3f@plt>

LLVM IR (-O0):
define void @Vertex3f(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @glVertex3f(i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @Vertex3f(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @glVertex3f(i32 %0, i32 %1, i32 %2)
ret void
}
void f6(void) {
  int z;
  {
#pragma unused(z)
  }
}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f6>:
ret

LLVM IR (-O0):
define void @f6() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
define void @f6() {
ret void
}
/* Variables and functions */
size_t strncpy_s(char *, size_t, char const *, int);
size_t strcpy_s(char *strDestination, size_t numberOfElements,
                const char *strSource) {
  return strncpy_s(strDestination, numberOfElements, strSource, -1);
}


x86 assembly (clang, -O0):
<strcpy_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0xffffffff,%ecx
call   1030 <strncpy_s@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy_s>:
mov    $0xffffffff,%ecx
jmp    1030 <strncpy_s@plt>

LLVM IR (-O0):
define i64 @strcpy_s(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i8*, i8** %6
%10 = call i64 @strncpy_s(i8* %7, i64 %8, i8* %9, i32 -1)
ret i64 %10
}

LLVM IR (-O2):
define i64 @strcpy_s(i8* %0, i64 %1, i8* %2) {
%4 = tail call i64 @strncpy_s(i8* %0, i64 %1, i8* %2, i32 -1)
ret i64 %4
}
void tes(int i, int *x) { *x = i; }


x86 assembly (clang, -O0):
<tes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<tes>:
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @tes(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = load i32*, i32** %4
store i32 %5, i32* %6
ret void
}

LLVM IR (-O2):
define void @tes(i32 %0, i32* nocapture writeonly %1) {
store i32 %0, i32* %1
ret void
}
void do2() {}


x86 assembly (clang, -O0):
<do2>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do2>:
ret

LLVM IR (-O0):
define void @do2() {
ret void
}

LLVM IR (-O2):
define void @do2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HandleEvents();
void Sys_SendKeyEvents(void) { HandleEvents(); }


x86 assembly (clang, -O0):
<Sys_SendKeyEvents>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HandleEvents@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sys_SendKeyEvents>:
xor    %eax,%eax
jmp    1030 <HandleEvents@plt>

LLVM IR (-O0):
define void @Sys_SendKeyEvents() {
%1 = call i32 (...) @HandleEvents()
ret void
}

LLVM IR (-O2):
define void @Sys_SendKeyEvents() {
%1 = tail call i32 (...) @HandleEvents()
ret void
}
unsigned geom_imin2f(const float v[2]) { return (v[0] < v[1]) ? 0 : 1; }


x86 assembly (clang, -O0):
<geom_imin2f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    $0x1,%eax
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_imin2f>:
movss  0x4(%rdi),%xmm0
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setbe  %al
ret

LLVM IR (-O0):
define i32 @geom_imin2f(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = load float*, float** %2
%7 = getelementptr inbounds float, float* %6, i64 1
%8 = load float, float* %7
%9 = fcmp olt float %5, %8
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 0, i32 1
ret i32 %11
}

LLVM IR (-O2):
define i32 @geom_imin2f(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = fcmp uge float %2, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ _Error(long, char *);
void Error_PostfixSyntaxMustStartWithExpression(long p_position) {
  _Error(p_position, "Postfix operator syntax must start with an expression");
}


x86 assembly (clang, -O0):
<Error_PostfixSyntaxMustStartWithExpression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <_Error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Error_PostfixSyntaxMustStartWithExpression>:
lea    0xee9(%rip),%rsi
jmp    1030 <_Error@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"Postfix operator syntax must start with an expression\00"
define void @Error_PostfixSyntaxMustStartWithExpression(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @_Error(i64 %3, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"Postfix operator syntax must start with an expression\00"
define void @Error_PostfixSyntaxMustStartWithExpression(i64 %0) {
%2 = tail call i32 @_Error(i64 %0, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int fact(int);
int main() { return fact(5); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1030 <fact@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x5,%edi
jmp    1030 <fact@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @fact(i32 5)
ret i32 %2
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @fact(i32 5)
ret i32 %1
}
int langdef_init(void) { return 0; }


x86 assembly (clang, -O0):
<langdef_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langdef_init>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @langdef_init() {
ret i32 0
}

LLVM IR (-O2):
define i32 @langdef_init() {
ret i32 0
}
/* Type definitions */
struct l_ctx_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct l_ctx_t *);
void l_ctx_del(struct l_ctx_t *ctx) { free(ctx); }


x86 assembly (clang, -O0):
<l_ctx_del>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_ctx_del>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.l_ctx_t = type { i32 }
define void @l_ctx_del(%struct.l_ctx_t* %0) {
%2 = alloca %struct.l_ctx_t*
store %struct.l_ctx_t* %0, %struct.l_ctx_t** %2
%3 = load %struct.l_ctx_t*, %struct.l_ctx_t** %2
%4 = call i32 @free(%struct.l_ctx_t* %3)
ret void
}

LLVM IR (-O2):
%struct.l_ctx_t = type { i32 }
define void @l_ctx_del(%struct.l_ctx_t* nocapture %0) {
%2 = tail call i32 @free(%struct.l_ctx_t* %0)
ret void
}
/* Variables and functions */
int rand();
double drand48(void) {
  int tmp;
  double __cil_tmp2;
  double __cil_tmp3;
  {
    { tmp = rand(); }
    {
      __cil_tmp2 = (double)2147483647;
      __cil_tmp3 = (double)tmp;
      return (__cil_tmp3 / __cil_tmp2);
    }
  }
}


x86 assembly (clang, -O0):
<drand48>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x4(%rbp)
movsd  0xed6(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drand48>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %eax,%xmm0
divsd  0xedc(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @drand48() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = call i32 (...) @rand()
store i32 %4, i32* %1
store double 0x41DFFFFFFFC00000, double* %2
%5 = load i32, i32* %1
%6 = sitofp i32 %5 to double
store double %6, double* %3
%7 = load double, double* %3
%8 = load double, double* %2
%9 = fdiv double %7, %8
ret double %9
}

LLVM IR (-O2):
define double @drand48() {
%1 = tail call i32 (...) @rand()
%2 = sitofp i32 %1 to double
%3 = fdiv double %2, 0x41DFFFFFFFC00000
ret double %3
}
signed char signedchar_ignoring_signedlongint(signed char x,
                                              signed long int y) {
  return x;
}


x86 assembly (clang, -O0):
<signedchar_ignoring_signedlongint>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signedchar_ignoring_signedlongint>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @signedchar_ignoring_signedlongint(i8 signext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i8, i8* %3
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @signedchar_ignoring_signedlongint(i8 returned signext %0, i64 %1) {
ret i8 %0
}
/* Variables and functions */
char *nvram_get(char const *);
char *nvram_safe_get(const char *name) {
  char *ret = nvram_get(name);
  return ret ? ret : "";
}


x86 assembly (clang, -O0):
<nvram_safe_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <nvram_get@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1141 <nvram_safe_get+0x31>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1151 <nvram_safe_get+0x41>
lea    0xeb8(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1151 <nvram_safe_get+0x41>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvram_safe_get>:
push   %rax
call   1030 <nvram_get@plt>
test   %rax,%rax
lea    0xee0(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @nvram_safe_get(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @nvram_get(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
br label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %8
%12 = phi i8* [ %9, %8 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %10 ]
ret i8* %12
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @nvram_safe_get(i8* %0) {
%2 = tail call i8* @nvram_get(i8* %0)
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ mvprintw(int, int, char *, char *);
void io_printplain(int x, int y, char *s) { mvprintw(y, x, "%s", s); }


x86 assembly (clang, -O0):
<io_printplain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rcx
lea    0xecd(%rip),%rdx
call   1030 <mvprintw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_printplain>:
mov    %rdx,%rcx
mov    %edi,%eax
lea    0xee4(%rip),%rdx
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <mvprintw@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @io_printplain(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = load i8*, i8** %6
%10 = call i32 @mvprintw(i32 %7, i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @io_printplain(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @mvprintw(i32 %1, i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int);
int main(void) {
  f(5, 6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
mov    $0x6,%esi
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0x6,%esi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 5, i32 6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 5, i32 6)
ret i32 0
}
/* Variables and functions */
int rand();
unsigned long get_random() { return rand() % 100; }


x86 assembly (clang, -O0):
<get_random>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @get_random() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 100
%3 = sext i32 %2 to i64
ret i64 %3
}

LLVM IR (-O2):
define i64 @get_random() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 100
%3 = sext i32 %2 to i64
ret i64 %3
}
int test_longlong(char *ptr) { return ++*((unsigned long long *)ptr); }


x86 assembly (clang, -O0):
<test_longlong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
add    $0x1,%rax
mov    %rax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_longlong>:
mov    (%rdi),%rax
add    $0x1,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define i32 @test_longlong(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i64*
%5 = load i64, i64* %4
%6 = add i64 %5, 1
store i64 %6, i64* %4
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_longlong(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = add i64 %3, 1
store i64 %4, i64* %2
%5 = trunc i64 %4 to i32
ret i32 %5
}
const char *LZ4_versionString(void) { return "1.9.1"; }


x86 assembly (clang, -O0):
<LZ4_versionString>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LZ4_versionString>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"1.9.1\00"
define i8* @LZ4_versionString() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"1.9.1\00"
define i8* @LZ4_versionString() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int test_imm_E6int64_lowword_mem(long long *val) {
  return ((*val) & (0xE6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E6int64_lowword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
and    $0xe6,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E6int64_lowword_mem>:
testb  $0xe6,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E6int64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 230
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_E6int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 230
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  scanf("%d", &a);
  if (a % 2 == 0) {
    printf("yes\n");
  } else {
    printf("no\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1164 <main+0x44>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1170 <main+0x50>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
testb  $0x1,0x4(%rsp)
lea    0xec8(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"yes\0A\00"
@.str.2 = [4 x i8] c"no\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = srem i32 %4, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [3 x i8] c"no\00"
@str.3 = [4 x i8] c"yes\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
/* Variables and functions */
char *getcwd(char *, int);
int /*<<< orphan*/ gethostname(char *, int);
int /*<<< orphan*/ printf(char *, char *, char *);
void Prompt() {
  char HOSTNAME[256];
  char *diractual, buf[256];
  diractual = getcwd(buf, 256);
  gethostname(HOSTNAME, 256);
  printf("%s:%s\\>", HOSTNAME, diractual);
}


x86 assembly (clang, -O0):
<Prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
lea    -0x210(%rbp),%rdi
mov    $0x100,%esi
call   1040 <getcwd@plt>
mov    %rax,-0x108(%rbp)
lea    -0x100(%rbp),%rdi
mov    $0x100,%esi
call   1050 <gethostname@plt>
lea    -0x100(%rbp),%rsi
mov    -0x108(%rbp),%rdx
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Prompt>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rsp,%rdi
mov    $0x100,%esi
call   1040 <getcwd@plt>
mov    %rax,%rbx
lea    0x100(%rsp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1050 <gethostname@plt>
lea    0xe9a(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s:%s\\>\00"
define void @Prompt() {
%1 = alloca [256 x i8]
%2 = alloca i8*
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i8* @getcwd(i8* %4, i32 256)
store i8* %5, i8** %2
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%7 = call i32 @gethostname(i8* %6, i32 256)
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s:%s\\>\00"
define void @Prompt() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i8* @getcwd(i8* %4, i32 256)
%6 = call i32 @gethostname(i8* %3, i32 256)
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %5)
ret void
}
float square(float a) { return a * a; }


x86 assembly (clang, -O0):
<square>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<square>:
mulss  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @square(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fmul float %3, %4
ret float %5
}

LLVM IR (-O2):
define float @square(float %0) {
%2 = fmul float %0, %0
ret float %2
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t ror64(uint64_t x, int r) { return (x >> r) | (x << (64 - r)); }


x86 assembly (clang, -O0):
<ror64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x40,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ror64>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
neg    %cl
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @ror64(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 64, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ror64(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = sub nsw i32 64, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Type definitions */
struct coprthr_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _printcl(char *, int, char *, char *);
void *marker(struct coprthr_device *dev, void *p) {
  do {
    if ("<7>"
        "cmdcall_x86_64:marker"[1] <= '0')
      _printcl("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/browndeer/coprthr/refs/heads/"
               "parallellocalypse/src/libcoprthr/arch/x86_64/devcmds_x86_64.c",
               495, "clmesg",
               "<7>"
               "cmdcall_x86_64:marker");
  } while (0);
  return (0);
}


x86 assembly (clang, -O0):
<marker>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
jmp    1111 <marker+0x11>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<marker>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.coprthr_device = type { i32 }
define i8* @marker(%struct.coprthr_device* %0, i8* %1) {
%3 = alloca %struct.coprthr_device*
%4 = alloca i8*
store %struct.coprthr_device* %0, %struct.coprthr_device** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %2
br label %6
6: ; preds = %5
ret i8* null
}

LLVM IR (-O2):
%struct.coprthr_device = type { i32 }
define noalias i8* @marker(%struct.coprthr_device* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void _bell(void) { fprintf(stdout, "\x07"); }


x86 assembly (clang, -O0):
<_bell>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bell>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [2 x i8] c"\07\00"
define void @_bell() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [2 x i8] c"\07\00"
define void @_bell() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ get_u32(unsigned int *, char *, int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int set_lifetime(unsigned int *lifetime, char *argv) {
  if (strcmp(argv, "forever") == 0)
    *lifetime = 0xFFFFFFFFU;
  else if (get_u32(lifetime, argv, 0))
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<set_lifetime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1159 <set_lifetime+0x39>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1183 <set_lifetime+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1030 <get_u32@plt>
cmp    $0x0,%rax
je     117e <set_lifetime+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    118a <set_lifetime+0x6a>
jmp    1183 <set_lifetime+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_lifetime>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     115a <set_lifetime+0x3a>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <get_u32@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1163 <set_lifetime+0x43>
jmp    1161 <set_lifetime+0x41>
movl   $0xffffffff,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"forever\00"
define i32 @set_lifetime(i32* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
store i32 -1, i32* %0
br label %9
6: ; preds = %2
%7 = tail call i64 @get_u32(i32* %0, i8* %1, i32 0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6, %5
br label %10
10: ; preds = %6, %9
%11 = phi i32 [ 0, %9 ], [ -1, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) { printf("usage: ./rw [input file] [output file]\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"usage: ./rw [input file] [output file]\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"usage: ./rw [input file] [output file]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr,
                "Usage: %s [-kst] [-b <num-retry> "
                "[-d <domainname>] <mapname>\n",
                getprogname());
  (void)fprintf(stderr, "       %s -x\n", getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xec1(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    0x2ea5(%rip),%r14
mov    (%r14),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb4(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    (%r14),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xed7(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [62 x i8] c"Usage: %s [-kst] [-b <num-retry> [-d <domainname>] <mapname>\0A\00"
@.str.1 = [14 x i8] c" %s -x\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i32, i32* @stderr
%5 = call i8* (...) @getprogname()
%6 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [62 x i8] c"Usage: %s [-kst] [-b <num-retry> [-d <domainname>] <mapname>\0A\00"
@.str.1 = [14 x i8] c" %s -x\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i32, i32* @stderr
%5 = tail call i8* (...) @getprogname()
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int chreke_server_authorize(unsigned char *, unsigned char *,
                            unsigned char const *, unsigned char const *,
                            size_t);
int ke_chreke_server_authorize(unsigned char *server_session,
                               unsigned char *key_agreed,
                               const unsigned char *client_auth,
                               const unsigned char *salt, size_t salt_len) {
  return chreke_server_authorize(server_session, key_agreed, client_auth, salt,
                                 salt_len);
}


x86 assembly (clang, -O0):
<ke_chreke_server_authorize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <chreke_server_authorize@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ke_chreke_server_authorize>:
jmp    1030 <chreke_server_authorize@plt>

LLVM IR (-O0):
define i32 @ke_chreke_server_authorize(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = load i8*, i8** %9
%15 = load i64, i64* %10
%16 = call i32 @chreke_server_authorize(i8* %11, i8* %12, i8* %13, i8* %14, i64 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @ke_chreke_server_authorize(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4) {
%6 = tail call i32 @chreke_server_authorize(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *av) {
  printf("Usage: %s modem_line_from_ex phone_number\n", av);
  printf("Example: phone /dev/pts/4 8675309\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Usage: %s modem_line_from_ex phone_number\0A\00"
@.str.1 = [35 x i8] c"Example: phone /dev/pts/4 8675309\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"Usage: %s modem_line_from_ex phone_number\0A\00"
@str = [34 x i8] c"Example: phone /dev/pts/4 8675309\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ names;
typedef int /*<<< orphan*/ ages;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char *argv[]) {
  int ages[] = {23, 11, 36, 56, 1, 10, 5, 16};
  char *names[] = {"Buddy", "Mickey"};
  printf("Size of ages = %d, size of names = %d size of &ages = %d \n",
         sizeof(ages), sizeof(names), sizeof(&ages));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cb7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cb4(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xebe(%rip),%rdi
mov    $0x20,%esi
mov    $0x10,%edx
mov    $0x8,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x20,%esi
mov    $0x10,%edx
mov    $0x8,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.ages = [8 x i32] [i32 23, i32 11, i32 36, i32 56, i32 1, i32 10, i32 5, i32 16]
@.str = [6 x i8] c"Buddy\00"
@.str.1 = [7 x i8] c"Mickey\00"
@__const.main.names = [2 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [59 x i8] c"Size of ages = %d, size of names = %d size of &ages = %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i32]
%7 = alloca [2 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [8 x i32]* %6 to i8*
%9 = bitcast [2 x i8*]* %7 to i8*
%10 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 32, i32 16, i32 8)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [59 x i8] c"Size of ages = %d, size of names = %d size of &ages = %d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 32, i32 16, i32 8)
ret i32 0
}