xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ calc_compensation(int);
int sra(int x, int k) {
  int xsrl = (unsigned)x >> k;
  if (x > 0) {
    return xsrl;
  } else {
    unsigned xsrl_unsigned = (unsigned)xsrl;
    xsrl_unsigned += calc_compensation(k);
    return (int)xsrl_unsigned;
  }
}


x86 assembly (clang, -O0):
<sra>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    113e <sra+0x2e>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <sra+0x4e>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <calc_compensation@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sra>:
push   %rbx
mov    %esi,%ecx
mov    %edi,%ebx
shr    %cl,%ebx
test   %edi,%edi
jg     1124 <sra+0x14>
mov    %ecx,%edi
call   1030 <calc_compensation@plt>
add    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sra(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = lshr i32 %8, %9
store i32 %10, i32* %6
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* %6
store i32 %14, i32* %3
br label %24
15: ; preds = %2
%16 = load i32, i32* %6
store i32 %16, i32* %7
%17 = load i32, i32* %5
%18 = call i64 @calc_compensation(i32 %17)
%19 = load i32, i32* %7
%20 = zext i32 %19 to i64
%21 = add nsw i64 %20, %18
%22 = trunc i64 %21 to i32
store i32 %22, i32* %7
%23 = load i32, i32* %7
store i32 %23, i32* %3
br label %24
24: ; preds = %15, %13
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @sra(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = icmp sgt i32 %0, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i64 @calc_compensation(i32 %1)
%7 = trunc i64 %6 to i32
%8 = add i32 %3, %7
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ %3, %2 ]
ret i32 %10
}
int *__h_errno_location(void) { return (int *)0; }


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

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

LLVM IR (-O0):
define i32* @__h_errno_location() {
ret i32* null
}

LLVM IR (-O2):
define noalias i32* @__h_errno_location() {
ret i32* null
}
/* Type definitions */
typedef int uint16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
void writeLittleShort(FILE *file, uint16_t value) {
  putc((value), file);
  putc((value >> 8), file);
}


x86 assembly (clang, -O0):
<writeLittleShort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0xc(%rbp),%edi
sar    $0x8,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeLittleShort>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
sar    $0x8,%ebx
mov    %ebx,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putc@plt>

LLVM IR (-O0):
define void @writeLittleShort(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 = load i32*, i32** %3
%7 = call i32 @putc(i32 %5, i32* %6)
%8 = load i32, i32* %4
%9 = ashr i32 %8, 8
%10 = load i32*, i32** %3
%11 = call i32 @putc(i32 %9, i32* %10)
ret void
}

LLVM IR (-O2):
define void @writeLittleShort(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @putc(i32 %1, i32* %0)
%4 = ashr i32 %1, 8
%5 = tail call i32 @putc(i32 %4, i32* %0)
ret void
}
/* Variables and functions */
int diag_fail();
int fail(const char *msg) { return diag_fail(); }


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

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

LLVM IR (-O0):
define i32 @fail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @diag_fail()
ret i32 %3
}

LLVM IR (-O2):
define i32 @fail(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @diag_fail()
ret i32 %2
}
/* Variables and functions */
scalar_t__ isinf(float);
int tm_check_inf_(float *src) {
  int result = 0;
  if (isinf(*src))
    result = 1;
  return result;
}


x86 assembly (clang, -O0):
<tm_check_inf_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <isinf@plt>
cmp    $0x0,%rax
je     1141 <tm_check_inf_+0x31>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tm_check_inf_>:
push   %rax
movss  (%rdi),%xmm0
call   1030 <isinf@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @tm_check_inf_(float* %0) {
%2 = alloca float*
%3 = alloca i32
store float* %0, float** %2
store i32 0, i32* %3
%4 = load float*, float** %2
%5 = load float, float* %4
%6 = call i64 @isinf(float %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %3
br label %9
9: ; preds = %8, %1
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @tm_check_inf_(float* nocapture %0) {
%2 = load float, float* %0
%3 = tail call i64 @isinf(float %2)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, int);
void get_c_string_(char **ptr_ptr, char *outstring, int *maxlen) {
  char *str1;
  if (*ptr_ptr == NULL)
    str1 = "";
  else
    str1 = *ptr_ptr;
  strncpy(outstring, str1, *maxlen);
}


x86 assembly (clang, -O0):
<get_c_string_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1142 <get_c_string_+0x32>
lea    0xec7(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    114d <get_c_string_+0x3d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
call   1030 <strncpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_c_string_>:
mov    %rsi,%rax
mov    (%rdi),%rcx
test   %rcx,%rcx
lea    0xee0(%rip),%rsi
cmovne %rcx,%rsi
mov    (%rdx),%edx
mov    %rax,%rdi
jmp    1030 <strncpy@plt>

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

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @get_c_string_(i8** nocapture %0, i8* %1, i32* nocapture %2) {
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %4
%7 = load i32, i32* %2
%8 = tail call i32 @strncpy(i8* %1, i8* %6, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
modl_reg() {
  fprintf(stderr, "Additional mechanisms from files\n");
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<modl_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    0xed8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xee3(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modl_reg>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef1(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Additional mechanisms from files\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @modl_reg() {
%1 = alloca i32
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Additional mechanisms from files\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @modl_reg() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 undef
}
void gtk_window_get_position() {}


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

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

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

LLVM IR (-O2):
define void @gtk_window_get_position() {
ret void
}
/* Type definitions */
struct inotify_event {
  int dummy;
};

/* Variables and functions */
struct inotify_event *inotifytools_next_events(int, int);
struct inotify_event *inotifytools_next_event(int timeout) {
  return inotifytools_next_events(timeout, 1);
}


x86 assembly (clang, -O0):
<inotifytools_next_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <inotifytools_next_events@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inotifytools_next_event>:
mov    $0x1,%esi
jmp    1030 <inotifytools_next_events@plt>

LLVM IR (-O0):
%struct.inotify_event = type { i32 }
define %struct.inotify_event* @inotifytools_next_event(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call %struct.inotify_event* @inotifytools_next_events(i32 %3, i32 1)
ret %struct.inotify_event* %4
}

LLVM IR (-O2):
%struct.inotify_event = type { i32 }
define %struct.inotify_event* @inotifytools_next_event(i32 %0) {
%2 = tail call %struct.inotify_event* @inotifytools_next_events(i32 %0, i32 1)
ret %struct.inotify_event* %2
}
unsigned short FROM32to16(unsigned int x) {
  x = (x & 0xffff) + (x >> 16);
  x = (x & 0xffff) + (x >> 16);
  return x;
}


x86 assembly (clang, -O0):
<FROM32to16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
mov    -0x4(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
mov    -0x4(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FROM32to16>:
movzwl %di,%ecx
shr    $0x10,%edi
add    %edi,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i16 @FROM32to16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65535
%5 = load i32, i32* %2
%6 = lshr i32 %5, 16
%7 = add i32 %4, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = and i32 %8, 65535
%10 = load i32, i32* %2
%11 = lshr i32 %10, 16
%12 = add i32 %9, %11
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = trunc i32 %13 to i16
ret i16 %14
}

LLVM IR (-O2):
define zeroext i16 @FROM32to16(i32 %0) {
%2 = and i32 %0, 65535
%3 = lshr i32 %0, 16
%4 = add nuw nsw i32 %2, %3
%5 = lshr i32 %4, 16
%6 = add nuw nsw i32 %5, %4
%7 = trunc i32 %6 to i16
ret i16 %7
}
/* Variables and functions */
int strlen(char *);
int chomp(char *s) {
  if (s && *s) {
    s += strlen(s) - 1;
    if (*s == '\n') {
      *s = 0;
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117b <chomp+0x6b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117b <chomp+0x6b>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1176 <chomp+0x66>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1182 <chomp+0x72>
jmp    117b <chomp+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     113d <chomp+0x2d>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     113d <chomp+0x2d>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    113d <chomp+0x2d>
movb   $0x0,-0x1(%rbx,%rax,1)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @chomp(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %25
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %25
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = call i32 @strlen(i8* %12)
%14 = sub nsw i32 %13, 1
%15 = load i8*, i8** %3
%16 = sext i32 %14 to i64
%17 = getelementptr inbounds i8, i8* %15, i64 %16
store i8* %17, i8** %3
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %24
22: ; preds = %11
%23 = load i8*, i8** %3
store i8 0, i8* %23
store i32 1, i32* %2
br label %26
24: ; preds = %11
br label %25
25: ; preds = %24, %6, %1
store i32 0, i32* %2
br label %26
26: ; preds = %25, %22
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @chomp(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %0)
%8 = add nsw i32 %7, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %6
store i8 0, i8* %10
br label %14
14: ; preds = %1, %3, %6, %13
%15 = phi i32 [ 1, %13 ], [ 0, %6 ], [ 0, %3 ], [ 0, %1 ]
ret i32 %15
}
/* Variables and functions */
int _tfsinit();
int /*<<< orphan*/ monLock();
int /*<<< orphan*/ monUnlock();
int mon_tfsinit(void) {
  int ret;
  monLock();
  ret = _tfsinit();
  monUnlock();
  return (ret);
}


x86 assembly (clang, -O0):
<mon_tfsinit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <monLock@plt>
mov    $0x0,%al
call   1030 <_tfsinit@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <monUnlock@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mon_tfsinit>:
push   %rbx
xor    %eax,%eax
call   1040 <monLock@plt>
xor    %eax,%eax
call   1030 <_tfsinit@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <monUnlock@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mon_tfsinit() {
%1 = alloca i32
%2 = call i32 (...) @monLock()
%3 = call i32 (...) @_tfsinit()
store i32 %3, i32* %1
%4 = call i32 (...) @monUnlock()
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @mon_tfsinit() {
%1 = tail call i32 (...) @monLock()
%2 = tail call i32 (...) @_tfsinit()
%3 = tail call i32 (...) @monUnlock()
ret i32 %2
}
/* Variables and functions */
scalar_t__ portWrite(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int set_TemmaDECcorrspeed(char *local_buffer) {
  char command[16];
  snprintf(command, 4, "LB%s", local_buffer);
  if (portWrite(command) < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<set_TemmaDECcorrspeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x4,%esi
lea    0xec0(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <portWrite@plt>
cmp    $0x0,%rax
jge    1164 <set_TemmaDECcorrspeed+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    116b <set_TemmaDECcorrspeed+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_TemmaDECcorrspeed>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rcx
lea    0xed1(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <portWrite@plt>
sar    $0x3f,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"LB%s\00"
define i32 @set_TemmaDECcorrspeed(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [16 x i8]
store i8* %0, i8** %3
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = call i32 @snprintf(i8* %5, i32 4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%9 = call i64 @portWrite(i8* %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [5 x i8] c"LB%s\00"
define i32 @set_TemmaDECcorrspeed(i8* %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i64 @portWrite(i8* %3)
%6 = ashr i64 %5, 63
%7 = trunc i64 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
void SCB_CleanInvalidateDCache_by_Addr(uint32_t *addr, int32_t dsize) {}


x86 assembly (clang, -O0):
<SCB_CleanInvalidateDCache_by_Addr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @SCB_CleanInvalidateDCache_by_Addr(i32* nocapture %0, i32 %1) {
ret void
}
int link(char *old, char *new) { return -1; }


x86 assembly (clang, -O0):
<link>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<link>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @link(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i32 -1
}

LLVM IR (-O2):
define i32 @link(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ ft_putendl(char const *);
int ft_rprint(const char *str, int ret) {
  ft_putendl(str);
  return (ret);
}


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

x86 assembly (clang, -O2):
<ft_rprint>:
push   %rbx
mov    %esi,%ebx
call   1030 <ft_putendl@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ft_rprint(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @ft_putendl(i8* %5)
%7 = load i32, i32* %4
ret i32 %7
}

LLVM IR (-O2):
define i32 @ft_rprint(i8* %0, i32 returned %1) {
%3 = tail call i32 @ft_putendl(i8* %0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ link_failure_nextafterf();
scalar_t__ nextafterf(float, float);
void test_nextafterf(float f1, float f2) {
  if (nextafterf(f1, f2) != nextafterf(f1, f2))
    link_failure_nextafterf();
}


x86 assembly (clang, -O0):
<test_nextafterf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <nextafterf@plt>
mov    %rax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <nextafterf@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     116b <test_nextafterf+0x4b>
mov    $0x0,%al
call   1030 <link_failure_nextafterf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_nextafterf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
call   1040 <nextafterf@plt>
mov    %rax,%rbx
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1040 <nextafterf@plt>
cmp    %rax,%rbx
jne    1155 <test_nextafterf+0x35>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <link_failure_nextafterf@plt>

LLVM IR (-O0):
define void @test_nextafterf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call i64 @nextafterf(float %5, float %6)
%8 = load float, float* %3
%9 = load float, float* %4
%10 = call i64 @nextafterf(float %8, float %9)
%11 = icmp ne i64 %7, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (...) @link_failure_nextafterf()
br label %14
14: ; preds = %12, %2
ret void
}

LLVM IR (-O2):
define void @test_nextafterf(float %0, float %1) {
%3 = tail call i64 @nextafterf(float %0, float %1)
%4 = tail call i64 @nextafterf(float %0, float %1)
%5 = icmp eq i64 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @link_failure_nextafterf()
br label %8
8: ; preds = %6, %2
ret void
}
void bu_compile_stringp(args) struct conscell *args;
{
  int n = bu_compile_arg_list(args);
  if (n != 1)
    goto er;
  EMIT1ATM("STRINGP");
  EMITEND();
  return;
er:
  cerror("stringp: wrong # of args", args);
}


x86 assembly (clang, -O0):
<bu_compile_stringp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <bu_compile_arg_list@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1169 <bu_compile_stringp+0x29>
jmp    1183 <bu_compile_stringp+0x43>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <EMIT1ATM@plt>
mov    $0x0,%al
call   1030 <EMITEND@plt>
jmp    1195 <bu_compile_stringp+0x55>
mov    -0x8(%rbp),%rsi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1060 <cerror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bu_compile_stringp>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <bu_compile_arg_list@plt>
cmp    $0x1,%eax
jne    1166 <bu_compile_stringp+0x26>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1050 <EMIT1ATM@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <EMITEND@plt>
lea    0xe9b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1060 <cerror@plt>

LLVM IR (-O0):
%struct.conscell = type opaque
@.str = [8 x i8] c"STRINGP\00"
@.str.1 = [25 x i8] c"stringp: wrong # of args\00"
define void @bu_compile_stringp(%struct.conscell* %0) {
%2 = alloca %struct.conscell*
%3 = alloca i32
store %struct.conscell* %0, %struct.conscell** %2
%4 = load %struct.conscell*, %struct.conscell** %2
%5 = call i32 (%struct.conscell*, ...) bitcast (i32 (...)* @bu_compile_arg_list to i32 (%struct.conscell*, ...)*)(%struct.conscell* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %1
br label %12
9: ; preds = %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @EMIT1ATM to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @EMITEND()
br label %15
12: ; preds = %8
%13 = load %struct.conscell*, %struct.conscell** %2
%14 = call i32 (i8*, %struct.conscell*, ...) bitcast (i32 (...)* @cerror to i32 (i8*, %struct.conscell*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %struct.conscell* %13)
br label %15
15: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
%struct.conscell = type opaque
@.str = [8 x i8] c"STRINGP\00"
@.str.1 = [25 x i8] c"stringp: wrong # of args\00"
define void @bu_compile_stringp(%struct.conscell* %0) {
%2 = tail call i32 (%struct.conscell*, ...) bitcast (i32 (...)* @bu_compile_arg_list to i32 (%struct.conscell*, ...)*)(%struct.conscell* %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @EMIT1ATM to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @EMITEND()
br label %9
7: ; preds = %1
%8 = tail call i32 (i8*, %struct.conscell*, ...) bitcast (i32 (...)* @cerror to i32 (i8*, %struct.conscell*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %struct.conscell* %0)
br label %9
9: ; preds = %7, %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_set1_epi64(int /*<<< orphan*/);
__m128i test_mm_set1_epi64(__m64 A) { return _mm_set1_epi64(A); }


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

x86 assembly (clang, -O2):
<test_mm_set1_epi64>:
jmp    1030 <_mm_set1_epi64@plt>

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

LLVM IR (-O2):
define i32 @test_mm_set1_epi64(i32 %0) {
%2 = tail call i32 @_mm_set1_epi64(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t image_read_u8(uintptr_t base, uintptr_t offset) {
  return *(uint8_t *)(base + offset);
}


x86 assembly (clang, -O0):
<image_read_u8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<image_read_u8>:
mov    (%rsi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @image_read_u8(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add i64 %5, %6
%8 = inttoptr i64 %7 to i32*
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @image_read_u8(i64 %0, i64 %1) {
%3 = add i64 %1, %0
%4 = inttoptr i64 %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
void *obs_encoder_get_weak_encoder(void *);
void *weak_encoder_ref(void *ref) { return obs_encoder_get_weak_encoder(ref); }


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

x86 assembly (clang, -O2):
<weak_encoder_ref>:
jmp    1030 <obs_encoder_get_weak_encoder@plt>

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

LLVM IR (-O2):
define i8* @weak_encoder_ref(i8* %0) {
%2 = tail call i8* @obs_encoder_get_weak_encoder(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ power(long, long);
int /*<<< orphan*/ printf(char *, long, long, int /*<<< orphan*/);
int main(void) {
  long x, y;
  x = 2;
  y = 5;
  printf("pow(%ld, %ld) is %ld.\n", x, y, power(x, y));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x2,-0x10(%rbp)
movq   $0x5,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <power@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x5,%esi
call   1030 <power@plt>
lea    0xec9(%rip),%rdi
mov    $0x2,%esi
mov    $0x5,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"pow(%ld, %ld) is %ld.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 2, i64* %2
store i64 5, i64* %3
%4 = load i64, i64* %2
%5 = load i64, i64* %3
%6 = load i64, i64* %2
%7 = load i64, i64* %3
%8 = call i32 @power(i64 %6, i64 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %4, i64 %5, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"pow(%ld, %ld) is %ld.\0A\00"
define i32 @main() {
%1 = tail call i32 @power(i64 2, i64 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 2, i64 5, i32 %1)
ret i32 0
}
void setRegLo(int *context, int reg_lo) { *(context + 6) = reg_lo; }


x86 assembly (clang, -O0):
<setRegLo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setRegLo>:
mov    %esi,0x18(%rdi)
ret

LLVM IR (-O0):
define void @setRegLo(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 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 6
store i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @setRegLo(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 6
store i32 %1, i32* %3
ret void
}
short int swab_16(short int val) {
  short int x;
  val &= 0xffff;
  x = (val & 0xff) << 8;
  x |= (val >> 8);
  return x;
}


x86 assembly (clang, -O0):
<swab_16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
and    $0xffff,%eax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    %ax,-0x4(%rbp)
movswl -0x2(%rbp),%ecx
sar    $0x8,%ecx
movswl -0x4(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x4(%rbp)
movswl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swab_16>:
mov    %edi,%eax
shl    $0x8,%eax
sar    $0x8,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define signext i16 @swab_16(i16 signext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = and i32 %5, 65535
%7 = trunc i32 %6 to i16
store i16 %7, i16* %2
%8 = load i16, i16* %2
%9 = sext i16 %8 to i32
%10 = and i32 %9, 255
%11 = shl i32 %10, 8
%12 = trunc i32 %11 to i16
store i16 %12, i16* %3
%13 = load i16, i16* %2
%14 = sext i16 %13 to i32
%15 = ashr i32 %14, 8
%16 = load i16, i16* %3
%17 = sext i16 %16 to i32
%18 = or i32 %17, %15
%19 = trunc i32 %18 to i16
store i16 %19, i16* %3
%20 = load i16, i16* %3
ret i16 %20
}

LLVM IR (-O2):
define signext i16 @swab_16(i16 signext %0) {
%2 = shl i16 %0, 8
%3 = ashr i16 %0, 8
%4 = or i16 %2, %3
ret i16 %4
}
/* Variables and functions */
int inotify_add_watch(int, char *, unsigned int);
int __inotify_add_watch(int fd, char *path, unsigned int flags) {
  return inotify_add_watch(fd, path, flags);
}


x86 assembly (clang, -O0):
<__inotify_add_watch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <inotify_add_watch@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__inotify_add_watch>:
jmp    1030 <inotify_add_watch@plt>

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

LLVM IR (-O2):
define i32 @__inotify_add_watch(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @inotify_add_watch(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
void zap_comments(char *s) {
  while (*s != '\0') {
    if (*s == '#') {
      *s = '\0';
      return;
    }
    s++;
  }
}


x86 assembly (clang, -O0):
<zap_comments>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1145 <zap_comments+0x45>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    1134 <zap_comments+0x34>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    1145 <zap_comments+0x45>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <zap_comments+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zap_comments>:
movzbl (%rdi),%eax
test   %al,%al
je     1114 <zap_comments+0x14>
cmp    $0x23,%al
je     1111 <zap_comments+0x11>
add    $0x1,%rdi
jmp    1100 <zap_comments>
movb   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @zap_comments(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 35
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = load i8*, i8** %2
store i8 0, i8* %14
br label %18
15: ; preds = %8
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13, %3
ret void
}

LLVM IR (-O2):
define void @zap_comments(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 35, label %5
]
5: ; preds = %2
store i8 0, i8* %3
br label %8
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __NR_gettid;
int syscall(int /*<<< orphan*/);
int gettid(void) { return syscall(__NR_gettid); }


x86 assembly (clang, -O0):
<gettid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettid>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_gettid = global i32 0
define i32 @gettid() {
%1 = load i32, i32* @__NR_gettid
%2 = call i32 @syscall(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@__NR_gettid = global i32 0
define i32 @gettid() {
%1 = load i32, i32* @__NR_gettid
%2 = tail call i32 @syscall(i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void vector_index_error(int i) {
  fprintf(stderr, "VectorIndexOutOfRange: %d\n", i);
}


x86 assembly (clang, -O0):
<vector_index_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xed2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_index_error>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"VectorIndexOutOfRange: %d\0A\00"
define void @vector_index_error(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int main() {
  int i;
  char string[42] = "Brace your self, CO328 project is coming!!";
  int j;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0x2a,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.string = [42 x i8] c"Brace your self, CO328 project is coming!!"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [42 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [42 x i8]* %3 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Begin();
int /*<<< orphan*/ Debug();
int main() {
  if (0)
    Debug();
  else
    Begin();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <Begin@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @Begin()
ret i32 0
}
/* Variables and functions */
int rom_present(char *);
int s3_phoenix_trio64_available(void) {
  return rom_present(L"roms/video/s3/86c764x1.bin");
}


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

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

LLVM IR (-O0):
@.str = [27 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 115, i32 51, i32 47, i32 56, i32 54, i32 99, i32 55, i32 54, i32 52, i32 120, i32 49, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @s3_phoenix_trio64_available() {
%1 = call i32 @rom_present(i8* bitcast ([27 x i32]* @.str to i8*))
ret i32 %1
}

LLVM IR (-O2):
@.str = [27 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 115, i32 51, i32 47, i32 56, i32 54, i32 99, i32 55, i32 54, i32 52, i32 120, i32 49, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @s3_phoenix_trio64_available() {
%1 = tail call i32 @rom_present(i8* bitcast ([27 x i32]* @.str to i8*))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, float);
int main(void) {
  int a, b;
  b = 20 + (a = 10);
  printf("a:%d and b:%d\n", a, b);
  int i;
  float j;
  j = i = 102.33;
  printf("i:%d and j:%f\n", i, j);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0x1e,-0x8(%rbp)
mov    -0x4(%rbp),%esi
cvtsi2ssl -0x8(%rbp),%xmm0
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
movl   $0x66,-0xc(%rbp)
movss  0xeb7(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%esi
movss  -0x10(%rbp),%xmm0
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
movss  0xecb(%rip),%xmm0
mov    $0x66,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"a:%d and b:%d\0A\00"
@.str.1 = [15 x i8] c"i:%d and j:%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 10, i32* %1
store i32 30, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = sitofp i32 %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5, float %7)
store i32 102, i32* %3
store float 1.020000e+02, float* %4
%9 = load i32, i32* %3
%10 = load float, float* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %9, float %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"a:%d and b:%d\0A\00"
@.str.1 = [15 x i8] c"i:%d and j:%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 10, float 3.000000e+01)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 102, float 1.020000e+02)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void message1() { printf("Hello "); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"Hello \00"
define void @message1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"Hello \00"
define void @message1() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
int fib(int x) {
  if (x <= 0) {
    return 1;
  } else {
    return fib(x - 1) + fib(x - 2);
  }
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1131 <fib+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1154 <fib+0x44>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    1137 <fib+0x27>
mov    %edi,%ebx
add    $0x2,%ebx
xor    %ebp,%ebp
xchg   %ax,%ax
lea    -0x3(%rbx),%edi
call   1030 <fib@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x2,%ebx
ja     1120 <fib+0x10>
add    $0x1,%ebp
jmp    113c <fib+0x2c>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fib(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = call i32 @fib(i32 %9)
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 2
%13 = call i32 @fib(i32 %12)
%14 = add nsw i32 %10, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %7, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 3
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
/* Variables and functions */
scalar_t__ shell_index(unsigned char, char);
unsigned nml_to_p(unsigned char n, signed char ml) {
  const int k = (int)shell_index(n, ml);
  return (unsigned)(k * (k + 2) + ml) / 2;
}


x86 assembly (clang, -O0):
<nml_to_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
movzbl %al,%edi
movsbl -0x2(%rbp),%esi
call   1030 <shell_index@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
movsbl -0x2(%rbp),%ecx
add    %ecx,%eax
shr    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nml_to_p>:
push   %rbx
mov    %esi,%ebx
call   1030 <shell_index@plt>
lea    0x2(%rax),%ecx
imul   %ecx,%eax
add    %ebx,%eax
shr    %eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @nml_to_p(i8 zeroext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = load i8, i8* %4
%8 = call i64 @shell_index(i8 zeroext %6, i8 signext %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 2
%13 = mul nsw i32 %10, %12
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = add nsw i32 %13, %15
%17 = udiv i32 %16, 2
ret i32 %17
}

LLVM IR (-O2):
define i32 @nml_to_p(i8 zeroext %0, i8 signext %1) {
%3 = tail call i64 @shell_index(i8 zeroext %0, i8 signext %1)
%4 = trunc i64 %3 to i32
%5 = add nsw i32 %4, 2
%6 = mul nsw i32 %5, %4
%7 = sext i8 %1 to i32
%8 = add nsw i32 %6, %7
%9 = lshr i32 %8, 1
ret i32 %9
}
int triangle(int i) { return i * (i + 1) / 2; }


x86 assembly (clang, -O0):
<triangle>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<triangle>:
lea    0x1(%rdi),%ecx
imul   %edi,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @triangle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
%6 = mul nsw i32 %3, %5
%7 = sdiv i32 %6, 2
ret i32 %7
}

LLVM IR (-O2):
define i32 @triangle(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = mul nsw i32 %2, %0
%4 = sdiv i32 %3, 2
ret i32 %4
}