xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exif_put_value(int const, int const, int, int,
                                  int /*<<< orphan*/, char const *);
int strlen(char const *);
void exif_put_str(const int ifd_nr, const int tag_id, const char *val) {
  int len = (val) ? strlen(val) + 1 : 0;
  exif_put_value(ifd_nr, tag_id, 2, len, 0, val);
}


x86 assembly (clang, -O0):
<exif_put_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1151 <exif_put_str+0x31>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115b <exif_put_str+0x3b>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    115b <exif_put_str+0x3b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r9
mov    $0x2,%edx
xor    %r8d,%r8d
call   1040 <exif_put_value@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exif_put_str>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%ebp
test   %rdx,%rdx
je     1140 <exif_put_str+0x20>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
add    $0x1,%ecx
jmp    1142 <exif_put_str+0x22>
xor    %ecx,%ecx
mov    %ebp,%edi
mov    %r14d,%esi
mov    $0x2,%edx
xor    %r8d,%r8d
mov    %rbx,%r9
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <exif_put_value@plt>

LLVM IR (-O0):
define void @exif_put_str(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = call i32 @strlen(i8* %11)
%13 = add nsw i32 %12, 1
br label %15
14: ; preds = %3
br label %15
15: ; preds = %14, %10
%16 = phi i32 [ %13, %10 ], [ 0, %14 ]
store i32 %16, i32* %7
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = load i32, i32* %7
%20 = load i8*, i8** %6
%21 = call i32 @exif_put_value(i32 %17, i32 %18, i32 2, i32 %19, i32 0, i8* %20)
ret void
}

LLVM IR (-O2):
define void @exif_put_str(i32 %0, i32 %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @strlen(i8* %2)
%7 = add nsw i32 %6, 1
br label %8
8: ; preds = %3, %5
%9 = phi i32 [ %7, %5 ], [ 0, %3 ]
%10 = tail call i32 @exif_put_value(i32 %0, i32 %1, i32 2, i32 %9, i32 0, i8* %2)
ret void
}
/* Variables and functions */
int setenv(char const *, char const *, int);
__attribute__((__weak__, __always___)) int
softboundmpx_setenv(const char *name, const char *value, int overwrite) {
  return setenv(name, value, overwrite);
}


x86 assembly (clang, -O0):
<softboundmpx_setenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <setenv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_setenv>:
jmp    1030 <setenv@plt>

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

LLVM IR (-O2):
define weak i32 @softboundmpx_setenv(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @setenv(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(double *, int, int);
void set_mv_double(double *d) { memset(d, 0xFF, sizeof(double)); }


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

x86 assembly (clang, -O2):
<set_mv_double>:
mov    $0xff,%esi
mov    $0x8,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @set_mv_double(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = call i32 @memset(double* %3, i32 255, i32 8)
ret void
}

LLVM IR (-O2):
define void @set_mv_double(double* %0) {
%2 = tail call i32 @memset(double* %0, i32 255, i32 8)
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("EOF is %d\n", EOF);
  printf("EOF is %d\n", EOF);
  printf("EOF is %d\n", EOF);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
mov    (%r14),%esi
lea    0xedb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"EOF is %d\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EOF
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EOF
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"EOF is %d\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EOF
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EOF
%6 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
void feed_utf8_parser_cleanup(struct feed_utf8_parser *const p_utf8_parser) {
  (void)(p_utf8_parser);
}


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

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

LLVM IR (-O0):
%struct.feed_utf8_parser = type opaque
define void @feed_utf8_parser_cleanup(%struct.feed_utf8_parser* %0) {
%2 = alloca %struct.feed_utf8_parser*
store %struct.feed_utf8_parser* %0, %struct.feed_utf8_parser** %2
%3 = load %struct.feed_utf8_parser*, %struct.feed_utf8_parser** %2
ret void
}

LLVM IR (-O2):
%struct.feed_utf8_parser = type opaque
define void @feed_utf8_parser_cleanup(%struct.feed_utf8_parser* nocapture %0) {
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ lstat(char const *, struct stat *);
int /*<<< orphan*/ perror(char *);
void safe_lstat(const char *filename, struct stat *buf) {
  if (lstat(filename, buf) != 0) {
    perror("lstat()");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<safe_lstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <lstat@plt>
cmp    $0x0,%rax
je     116d <safe_lstat+0x3d>
lea    0xea2(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_lstat>:
push   %rax
call   1030 <lstat@plt>
test   %rax,%rax
jne    113d <safe_lstat+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [8 x i8] c"lstat()\00"
define void @safe_lstat(i8* %0, %struct.stat* %1) {
%3 = alloca i8*
%4 = alloca %struct.stat*
store i8* %0, i8** %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i8*, i8** %3
%6 = load %struct.stat*, %struct.stat** %4
%7 = call i64 @lstat(i8* %5, %struct.stat* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [8 x i8] c"lstat()\00"
define void @safe_lstat(i8* nocapture %0, %struct.stat* nocapture %1) {
%3 = tail call i64 @lstat(i8* %0, %struct.stat* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
ret void
}
/* Variables and functions */
int brk(void *);
void *decibel_brk(void *);
void *sbrk(intptr_t increment) {
  void *curbrk = decibel_brk((void *)0);
  void *newbrk = (unsigned char *)curbrk + increment;
  if (-1 == brk(newbrk))
    return (void *)-1;
  return curbrk;
}


x86 assembly (clang, -O0):
<sbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <decibel_brk@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <brk@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    116d <sbrk+0x4d>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1175 <sbrk+0x55>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbrk>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <decibel_brk@plt>
mov    %rax,%r14
add    %rax,%rbx
mov    %rbx,%rdi
call   1030 <brk@plt>
cmp    $0xffffffff,%eax
mov    $0xffffffffffffffff,%rax
cmovne %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @sbrk(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
store i64 %0, i64* %3
%6 = call i8* @decibel_brk(i8* null)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = load i64, i64* %3
%9 = getelementptr inbounds i8, i8* %7, i64 %8
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = call i32 @brk(i8* %10)
%12 = icmp eq i32 -1, %11
br i1 %12, label %13, label %14
13: ; preds = %1
store i8* inttoptr (i64 -1 to i8*), i8** %2
br label %16
14: ; preds = %1
%15 = load i8*, i8** %4
store i8* %15, i8** %2
br label %16
16: ; preds = %14, %13
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
define i8* @sbrk(i64 %0) {
%2 = tail call i8* @decibel_brk(i8* null)
%3 = getelementptr inbounds i8, i8* %2, i64 %0
%4 = tail call i32 @brk(i8* %3)
%5 = icmp eq i32 %4, -1
%6 = select i1 %5, i8* inttoptr (i64 -1 to i8*), i8* %2
ret i8* %6
}
void reset_array(double *array, int N) {
  for (int n = 0; n < N; n++) {
    array[n] = 0.0;
  }
}


x86 assembly (clang, -O0):
<reset_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <reset_array+0x3c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <reset_array+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_array>:
test   %esi,%esi
jle    1126 <reset_array+0x16>
push   %rax
mov    %esi,%edx
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @reset_array(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load double*, double** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
store double 0.000000e+00, double* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @reset_array(double* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast double* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 3
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tracyWidom(char *, char *);
void R_tracyWidom(char **R_input_file, char **R_output_file) {
  tracyWidom(*R_input_file, *R_output_file);
}


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

x86 assembly (clang, -O2):
<R_tracyWidom>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <tracyWidom@plt>

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

LLVM IR (-O2):
define void @R_tracyWidom(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @tracyWidom(i8* %3, i8* %4)
ret void
}
double c2f(double d) { return (d * 9) / 5 + 32; }


x86 assembly (clang, -O0):
<c2f>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xed6(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2f>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
addsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @c2f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 9.000000e+00
%5 = fdiv double %4, 5.000000e+00
%6 = fadd double %5, 3.200000e+01
ret double %6
}

LLVM IR (-O2):
define double @c2f(double %0) {
%2 = fmul double %0, 9.000000e+00
%3 = fdiv double %2, 5.000000e+00
%4 = fadd double %3, 3.200000e+01
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a = 3, b = 4;
  printf("a=%d,b=%d\n", a, b);
  a = a + b;
  b = a - b;
  a = a - b;
  printf("a=%d,b=%d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x4,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x3,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"a=%d,b=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
store i32 4, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = add nsw i32 %7, %8
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = sub nsw i32 %10, %11
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = sub nsw i32 %13, %14
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"a=%d,b=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 3, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 4, i32 3)
ret i32 0
}
/* Type definitions */
struct clad_test {
  int dummy;
};

/* Variables and functions */
struct clad_test *clad_test_assert(struct clad_test *, int, char *, void *,
                                   void *, char const *);
struct clad_test *clad_test_ptrneq(struct clad_test *test, void *p1, void *p2,
                                   const char *explain) {
  return clad_test_assert(test, p1 != p2,
                          "Pointers should not be equal: %p %p; %s ", p1, p2,
                          explain);
}


x86 assembly (clang, -O0):
<clad_test_ptrneq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%esi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xeb1(%rip),%rdx
call   1030 <clad_test_assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clad_test_ptrneq>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
xor    %esi,%esi
cmp    %rdx,%rcx
setne  %sil
lea    0xed7(%rip),%rdx
jmp    1030 <clad_test_assert@plt>

LLVM IR (-O0):
%struct.clad_test = type { i32 }
@.str = [41 x i8] c"Pointers should not be equal: %p %p; %s \00"
define %struct.clad_test* @clad_test_ptrneq(%struct.clad_test* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca %struct.clad_test*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store %struct.clad_test* %0, %struct.clad_test** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load %struct.clad_test*, %struct.clad_test** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = icmp ne i8* %10, %11
%13 = zext i1 %12 to i32
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = load i8*, i8** %8
%17 = call %struct.clad_test* @clad_test_assert(%struct.clad_test* %9, i32 %13, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15, i8* %16)
ret %struct.clad_test* %17
}

LLVM IR (-O2):
%struct.clad_test = type { i32 }
@.str = [41 x i8] c"Pointers should not be equal: %p %p; %s \00"
define %struct.clad_test* @clad_test_ptrneq(%struct.clad_test* %0, i8* %1, i8* %2, i8* %3) {
%5 = icmp ne i8* %1, %2
%6 = zext i1 %5 to i32
%7 = tail call %struct.clad_test* @clad_test_assert(%struct.clad_test* %0, i32 %6, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %3)
ret %struct.clad_test* %7
}
/* Variables and functions */
int /*<<< orphan*/ psw_write_bit(int, int);
void psw_set_ov(void) { psw_write_bit(2, 1); }


x86 assembly (clang, -O0):
<psw_set_ov>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
mov    $0x1,%esi
call   1030 <psw_write_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<psw_set_ov>:
mov    $0x2,%edi
mov    $0x1,%esi
jmp    1030 <psw_write_bit@plt>

LLVM IR (-O0):
define void @psw_set_ov() {
%1 = call i32 @psw_write_bit(i32 2, i32 1)
ret void
}

LLVM IR (-O2):
define void @psw_set_ov() {
%1 = tail call i32 @psw_write_bit(i32 2, i32 1)
ret void
}
int two() { return 2; }


x86 assembly (clang, -O0):
<two>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @two() {
ret i32 2
}

LLVM IR (-O2):
define i32 @two() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHelp() {
  printf("{} enclose mandatory arguments. [] enclose optional "
         "arguments.\nrepeat - repeat a character sequence.\nrepeat --version "
         "- print the version information.\nrepeat --help - print this help "
         "message.\nrepeat {-n 'number of repeats'} [-s 'string to repeat'] "
         "[-f]\nExamples:\nrepeat -n 42 - print '=' 42 times, where 12 can be "
         "any positive integer.\nrepeat -n 34 -s Hi - print 'Hi' 34 times, "
         "where 34 can be any positive integer.\nrepeat -s A\\ Message -n 10 "
         "-f - print 'A\\ Message' 10 times and end it with a linefeed.\n");
}


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

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

LLVM IR (-O0):
@.str = [505 x i8] c"{} enclose mandatory arguments. [] enclose optional arguments.\0Arepeat - repeat a character sequence.\0Arepeat --version - print the version information.\0Arepeat --help - print this help message.\0Arepeat {-n 'number of repeats'} [-s 'string to repeat'] [-f]\0AExamples:\0Arepeat -n 42 - print '=' 42 times, where 12 can be any positive integer.\0Arepeat -n 34 -s Hi - print 'Hi' 34 times, where 34 can be any positive integer.\0Arepeat -s A\\ Message -n 10 -f - print 'A\\ Message' 10 times and end it with a linefeed.\0A\00"
define void @printHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([505 x i8], [505 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [504 x i8] c"{} enclose mandatory arguments. [] enclose optional arguments.\0Arepeat - repeat a character sequence.\0Arepeat --version - print the version information.\0Arepeat --help - print this help message.\0Arepeat {-n 'number of repeats'} [-s 'string to repeat'] [-f]\0AExamples:\0Arepeat -n 42 - print '=' 42 times, where 12 can be any positive integer.\0Arepeat -n 34 -s Hi - print 'Hi' 34 times, where 34 can be any positive integer.\0Arepeat -s A\\ Message -n 10 -f - print 'A\\ Message' 10 times and end it with a linefeed.\00"
define void @printHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([504 x i8], [504 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct TIC_sRoute {
  int dummy;
};
struct TIC_conf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dolog(int, char *, struct TIC_conf *);
struct TIC_sRoute *tic_ListRoutes(struct TIC_conf *tic) {
  dolog(3, "Not implemented - tic_ListRoutes(%x)\n", tic);
  return NULL;
}


x86 assembly (clang, -O0):
<tic_ListRoutes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x3,%edi
lea    0xed4(%rip),%rsi
call   1030 <dolog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tic_ListRoutes>:
push   %rax
mov    %rdi,%rdx
lea    0xee5(%rip),%rsi
mov    $0x3,%edi
call   1030 <dolog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TIC_sRoute = type { i32 }
%struct.TIC_conf = type { i32 }
@.str = [38 x i8] c"Not implemented - tic_ListRoutes(%x)\0A\00"
define %struct.TIC_sRoute* @tic_ListRoutes(%struct.TIC_conf* %0) {
%2 = alloca %struct.TIC_conf*
store %struct.TIC_conf* %0, %struct.TIC_conf** %2
%3 = load %struct.TIC_conf*, %struct.TIC_conf** %2
%4 = call i32 @dolog(i32 3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %struct.TIC_conf* %3)
ret %struct.TIC_sRoute* null
}

LLVM IR (-O2):
%struct.TIC_sRoute = type { i32 }
%struct.TIC_conf = type { i32 }
@.str = [38 x i8] c"Not implemented - tic_ListRoutes(%x)\0A\00"
define noalias %struct.TIC_sRoute* @tic_ListRoutes(%struct.TIC_conf* %0) {
%2 = tail call i32 @dolog(i32 3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %struct.TIC_conf* %0)
ret %struct.TIC_sRoute* null
}
/* Variables and functions */
int /*<<< orphan*/ log_f(char *);
void joystickb_none_poll(void) {
  log_f("joystickb:none: joystickb_none_poll()\n");
}


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

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

LLVM IR (-O0):
@.str = [39 x i8] c"joystickb:none: joystickb_none_poll()\0A\00"
define void @joystickb_none_poll() {
%1 = call i32 @log_f(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"joystickb:none: joystickb_none_poll()\0A\00"
define void @joystickb_none_poll() {
%1 = tail call i32 @log_f(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func(unsigned int);
int main() {
  unsigned i;
  for (i = 0; i < 10; ++i)
    func(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jae    1146 <main+0x36>
mov    -0x8(%rbp),%edi
call   1030 <func@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <func@plt>
mov    $0x1,%edi
call   1030 <func@plt>
mov    $0x2,%edi
call   1030 <func@plt>
mov    $0x3,%edi
call   1030 <func@plt>
mov    $0x4,%edi
call   1030 <func@plt>
mov    $0x5,%edi
call   1030 <func@plt>
mov    $0x6,%edi
call   1030 <func@plt>
mov    $0x7,%edi
call   1030 <func@plt>
mov    $0x8,%edi
call   1030 <func@plt>
mov    $0x9,%edi
call   1030 <func@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @func(i32 0)
%2 = tail call i32 @func(i32 1)
%3 = tail call i32 @func(i32 2)
%4 = tail call i32 @func(i32 3)
%5 = tail call i32 @func(i32 4)
%6 = tail call i32 @func(i32 5)
%7 = tail call i32 @func(i32 6)
%8 = tail call i32 @func(i32 7)
%9 = tail call i32 @func(i32 8)
%10 = tail call i32 @func(i32 9)
ret i32 0
}
int default_score(char x, char y) {
  if ((x == 'n') || (x == 'N') || (y == 'n') || (y == 'N')) {
    return 0;
  }
  if (x != y) {
    return 3;
  }
  return 0;
}


x86 assembly (clang, -O0):
<default_score>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
je     1144 <default_score+0x44>
movsbl -0x5(%rbp),%eax
cmp    $0x4e,%eax
je     1144 <default_score+0x44>
movsbl -0x6(%rbp),%eax
cmp    $0x6e,%eax
je     1144 <default_score+0x44>
movsbl -0x6(%rbp),%eax
cmp    $0x4e,%eax
jne    1150 <default_score+0x50>
movl   $0x0,-0x4(%rbp)
jmp    1173 <default_score+0x73>
movsbl -0x5(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
je     116c <default_score+0x6c>
movl   $0x3,-0x4(%rbp)
jmp    1173 <default_score+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_score>:
mov    %edi,%eax
and    $0xdf,%al
mov    %esi,%ecx
and    $0xdf,%cl
xor    %edx,%edx
cmp    $0x4e,%cl
setne  %dl
xor    %ecx,%ecx
cmp    $0x4e,%al
lea    (%rdx,%rdx,2),%eax
cmove  %ecx,%eax
cmp    %sil,%dil
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @default_score(i8 signext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 110
br i1 %8, label %21, label %9
9: ; preds = %2
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 78
br i1 %12, label %21, label %13
13: ; preds = %9
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 110
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8, i8* %5
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 78
br i1 %20, label %21, label %22
21: ; preds = %17, %13, %9, %2
store i32 0, i32* %3
br label %30
22: ; preds = %17
%23 = load i8, i8* %4
%24 = sext i8 %23 to i32
%25 = load i8, i8* %5
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %24, %26
br i1 %27, label %28, label %29
28: ; preds = %22
store i32 3, i32* %3
br label %30
29: ; preds = %22
store i32 0, i32* %3
br label %30
30: ; preds = %29, %28, %21
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @default_score(i8 signext %0, i8 signext %1) {
%3 = and i8 %0, -33
%4 = icmp eq i8 %3, 78
%5 = and i8 %1, -33
%6 = icmp eq i8 %5, 78
%7 = or i1 %4, %6
%8 = icmp eq i8 %0, %1
%9 = or i1 %8, %7
%10 = select i1 %9, i32 0, i32 3
ret i32 %10
}
/* Variables and functions */
size_t base_decode_chunk_sz(int);
size_t base_decode_buffer_sz(int bits) {
  size_t tsz = 1;
  size_t csz = base_decode_chunk_sz(bits);
  size_t c = 1;
  while (tsz < 768) {
    tsz = c * csz;
    c++;
  }
  return tsz;
}


x86 assembly (clang, -O0):
<base_decode_buffer_sz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <base_decode_chunk_sz@plt>
mov    %rax,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
cmpq   $0x300,-0x10(%rbp)
jae    1163 <base_decode_buffer_sz+0x53>
mov    -0x20(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1137 <base_decode_buffer_sz+0x27>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_decode_buffer_sz>:
push   %rax
call   1030 <base_decode_chunk_sz@plt>
mov    %rax,%rcx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
add    %rcx,%rax
cmp    $0x300,%rax
jb     1120 <base_decode_buffer_sz+0x10>
pop    %rcx
ret

LLVM IR (-O0):
define i64 @base_decode_buffer_sz(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 %0, i32* %2
store i64 1, i64* %3
%6 = load i32, i32* %2
%7 = call i64 @base_decode_chunk_sz(i32 %6)
store i64 %7, i64* %4
store i64 1, i64* %5
br label %8
8: ; preds = %11, %1
%9 = load i64, i64* %3
%10 = icmp ult i64 %9, 768
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i64, i64* %5
%13 = load i64, i64* %4
%14 = mul i64 %12, %13
store i64 %14, i64* %3
%15 = load i64, i64* %5
%16 = add i64 %15, 1
store i64 %16, i64* %5
br label %8
17: ; preds = %8
%18 = load i64, i64* %3
ret i64 %18
}

LLVM IR (-O2):
define i64 @base_decode_buffer_sz(i32 %0) {
%2 = tail call i64 @base_decode_chunk_sz(i32 %0)
br label %3
3: ; preds = %1, %3
%4 = phi i64 [ 1, %1 ], [ %6, %3 ]
%5 = mul i64 %4, %2
%6 = add i64 %4, 1
%7 = icmp ult i64 %5, 768
br i1 %7, label %3, label %8
8: ; preds = %3
ret i64 %5
}
void _start(void) {
  volatile int x = 0;
  while (++x)
    ;
}


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     1122 <_start+0x22>
jmp    110b <_start+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_start>:
movl   $0x0,-0x4(%rsp)
nopl   0x0(%rax,%rax,1)
addl   $0x1,-0x4(%rsp)
jne    1110 <_start+0x10>
ret

LLVM IR (-O0):
define void @_start() {
%1 = alloca i32
store volatile i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load volatile i32, i32* %1
%4 = add nsw i32 %3, 1
store volatile i32 %4, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2
br label %2
7: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @_start() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
br label %3
3: ; preds = %3, %0
%4 = load volatile i32, i32* %1
%5 = add nsw i32 %4, 1
store volatile i32 %5, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3
ret void
}
int main() {
  int a;
  a = 3;
  if (a > 1)
    return 1;
  else
    return 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1128 <main+0x28>
movl   $0x1,-0x4(%rbp)
jmp    112f <main+0x2f>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 1
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %7
6: ; preds = %0
store i32 2, i32* %1
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
int no_of_digits(char *str) {
  int digits;
  for (digits = 0; str[digits] != '\0'; digits++)
    ;
  return digits;
}


x86 assembly (clang, -O0):
<no_of_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <no_of_digits+0x37>
jmp    1129 <no_of_digits+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <no_of_digits+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_of_digits>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <no_of_digits+0x10>
ret

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

LLVM IR (-O2):
define i32 @no_of_digits(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ dump_stuff_be_noeol(void *, unsigned int);
int /*<<< orphan*/ printf(char *);
void dump_stuff_be(void *x, unsigned int size) {
  dump_stuff_be_noeol(x, size);
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_stuff_be>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <dump_stuff_be_noeol@plt>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_stuff_be>:
push   %rax
call   1030 <dump_stuff_be_noeol@plt>
mov    $0xa,%edi
pop    %rax
jmp    1040 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @dump_stuff_be(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 = load i32, i32* %4
%7 = call i32 @dump_stuff_be_noeol(i8* %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @dump_stuff_be(i8* %0, i32 %1) {
%3 = tail call i32 @dump_stuff_be_noeol(i8* %0, i32 %1)
%4 = tail call i32 @putchar(i32 10)
ret void
}
int randompart(int total, int count, char *s, char *code, int *index) {
  return (0);
}


x86 assembly (clang, -O0):
<randompart>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @randompart(i32 %0, i32 %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i32* nocapture readnone %4) {
ret i32 0
}
float sin(float x) { return native_sin(((x)*0.01745329251f)); }


x86 assembly (clang, -O0):
<sin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <native_sin@plt>
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sin>:
push   %rax
mulss  0xee7(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <native_sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @sin(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 0x3F91DF46A0000000
%5 = fpext float %4 to double
%6 = call i32 (double, ...) bitcast (i32 (...)* @native_sin to i32 (double, ...)*)(double %5)
%7 = sitofp i32 %6 to float
ret float %7
}

LLVM IR (-O2):
define float @sin(float %0) {
%2 = fmul float %0, 0x3F91DF46A0000000
%3 = fpext float %2 to double
%4 = tail call i32 (double, ...) bitcast (i32 (...)* @native_sin to i32 (double, ...)*)(double %3)
%5 = sitofp i32 %4 to float
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ bar(int, int, int);
void foo(int a, int b, int c) {
  foo(a, b, c);
  bar(a, b, c);
  foo(a, b, c);
  bar(a, b, c);
}


x86 assembly (clang, -O0):
<foo>:
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   1040 <foo@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <bar@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <foo@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
call   1040 <foo@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <bar@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <foo@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo(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 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @bar(i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = call i32 @bar(i32 %17, i32 %18, i32 %19)
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1, i32 %2) {
tail call void @foo(i32 %0, i32 %1, i32 %2)
%4 = tail call i32 @bar(i32 %0, i32 %1, i32 %2)
tail call void @foo(i32 %0, i32 %1, i32 %2)
%5 = tail call i32 @bar(i32 %0, i32 %1, i32 %2)
ret void
}
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ list_add_tail(struct list_head *, struct list_head *);
void fimg2d_enqueue(struct list_head *node, struct list_head *q) {
  list_add_tail(node, q);
}


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

x86 assembly (clang, -O2):
<fimg2d_enqueue>:
jmp    1030 <list_add_tail@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @fimg2d_enqueue(%struct.list_head* %0, %struct.list_head* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.list_head* %1, %struct.list_head** %4
%5 = load %struct.list_head*, %struct.list_head** %3
%6 = load %struct.list_head*, %struct.list_head** %4
%7 = call i32 @list_add_tail(%struct.list_head* %5, %struct.list_head* %6)
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @fimg2d_enqueue(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @list_add_tail(%struct.list_head* %0, %struct.list_head* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getch();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
main() {
  int size;
  char str[100];
  printf("Entre com uma string: ");
  gets(str);
  size = strlen(str);
  printf("\n\nA string que voce digitou tem tamanho %d", size);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Entre com uma string: \00"
@.str.1 = [43 x i8] c"\0A\0AA string que voce digitou tem tamanho %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Entre com uma string: \00"
@.str.1 = [43 x i8] c"\0A\0AA string que voce digitou tem tamanho %d\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @strlen(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @getch()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ test(int *);
int main() {
  int num = 25;
  printf("Example of Passing a "
         "Function Argument's Address\n\n");
  printf("num=%d\n\n", num);
  test(&num);
  printf("num=%d   !!BINGO!!\n\n", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x19,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1040 <test@plt>
mov    -0x8(%rbp),%esi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x19,0x4(%rsp)
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
mov    $0x19,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rdi
call   1050 <test@plt>
mov    0x4(%rsp),%esi
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Example of Passing a Function Argument's Address\0A\0A\00"
@.str.1 = [9 x i8] c"num=%d\0A\0A\00"
@.str.2 = [21 x i8] c"num=%d !!BINGO!!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 25, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 @test(i32* %2)
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"num=%d\0A\0A\00"
@.str.2 = [21 x i8] c"num=%d !!BINGO!!\0A\0A\00"
@str = [50 x i8] c"Example of Passing a Function Argument's Address\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 25, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 25)
%5 = call i32 @test(i32* %1)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int x;
  if (!x) {
    assert(x == 0);
  } else {
    assert(x == 1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113f <main+0x2f>
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    1150 <main+0x40>
cmpl   $0x1,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ calc_mask(unsigned long);
int /*<<< orphan*/ print_dotquad(int /*<<< orphan*/, int);
unsigned long read_ulong(int);
void print_mask() {
  unsigned long bits = read_ulong(0xD0);
  if (bits != 0)
    print_dotquad(calc_mask(bits), 1);
}


x86 assembly (clang, -O0):
<print_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xd0,%edi
call   1040 <read_ulong@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1166 <print_mask+0x36>
mov    -0x8(%rbp),%rdi
call   1030 <calc_mask@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1050 <print_dotquad@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mask>:
push   %rax
mov    $0xd0,%edi
call   1040 <read_ulong@plt>
test   %rax,%rax
je     1155 <print_mask+0x25>
mov    %rax,%rdi
call   1030 <calc_mask@plt>
mov    %eax,%edi
mov    $0x1,%esi
pop    %rax
jmp    1050 <print_dotquad@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @print_mask() {
%1 = alloca i64
%2 = call i64 @read_ulong(i32 208)
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i64, i64* %1
%7 = call i32 @calc_mask(i64 %6)
%8 = call i32 @print_dotquad(i32 %7, i32 1)
br label %9
9: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
define void @print_mask() {
%1 = tail call i64 @read_ulong(i32 208)
%2 = icmp eq i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @calc_mask(i64 %1)
%5 = tail call i32 @print_dotquad(i32 %4, i32 1)
br label %6
6: ; preds = %3, %0
ret void
}