xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ tolower(int);
int char_ci_gt(int c1, int c2) { return tolower(c1) > tolower(c2); }


x86 assembly (clang, -O0):
<char_ci_gt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <tolower@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <tolower@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_ci_gt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <tolower@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <tolower@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
setg   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @char_ci_gt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i64 @tolower(i32 %5)
%7 = load i32, i32* %4
%8 = call i64 @tolower(i32 %7)
%9 = icmp sgt i64 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @char_ci_gt(i32 %0, i32 %1) {
%3 = tail call i64 @tolower(i32 %0)
%4 = tail call i64 @tolower(i32 %1)
%5 = icmp sgt i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMR4C_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


x86 assembly (clang, -O0):
<U_WMR4C_swap>:
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 <U_WMRNOTIMPLEMENTED_swap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_WMR4C_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

LLVM IR (-O0):
define void @U_WMR4C_swap(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 @U_WMRNOTIMPLEMENTED_swap(i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @U_WMR4C_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
void list_integers() {
  int lower = 21;
  int upper = 309;
  printf("Counting from %d up to %d...\n", lower, upper);
  for (; lower <= upper; lower++) {
    printf("%d\n", lower);
  }
}


x86 assembly (clang, -O0):
<list_integers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x15,-0x4(%rbp)
movl   $0x135,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1165 <list_integers+0x55>
mov    -0x4(%rbp),%esi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113a <list_integers+0x2a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_integers>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
mov    $0x15,%ebx
mov    $0x15,%esi
mov    $0x135,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee6(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x136,%ebx
jne    1140 <list_integers+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Counting from %d up to %d...\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @list_integers() {
%1 = alloca i32
%2 = alloca i32
store i32 21, i32* %1
store i32 309, i32* %2
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i32, i32* %1
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 1
store i32 %15, i32* %1
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Counting from %d up to %d...\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @list_integers() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 21, i32 309)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 21, %0 ], [ %5, %2 ]
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 310
br i1 %6, label %7, label %2
7: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void version() {
  fprintf(stdout,
          "Program Name"
          " version: "
          "\x1b[37m"
          "%s\n"
          "\x1b[0m",
          "0.0.1");
}


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

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [35 x i8] c"Program Name version: \1B[37m%s\0A\1B[0m\00"
@.str.1 = [6 x i8] c"0.0.1\00"
define void @version() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [35 x i8] c"Program Name version: \1B[37m%s\0A\1B[0m\00"
@.str.1 = [6 x i8] c"0.0.1\00"
define void @version() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t strlen(char const *);
char *strdup(const char *str) {
  size_t n;
  char *p;
  n = strlen(str);
  if ((p = (char *)malloc(n)) == NULL)
    return (NULL);
  memcpy(p, str, n);
  p[n] = '\0';
  return (p);
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    116d <strdup+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1192 <strdup+0x62>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1165 <strdup+0x35>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
jmp    1167 <strdup+0x37>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = tail call i64 @malloc(i64 %2)
%4 = inttoptr i64 %3 to i8*
%5 = icmp eq i64 %3, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %2)
%8 = getelementptr inbounds i8, i8* %4, i64 %2
store i8 0, i8* %8
br label %9
9: ; preds = %1, %6
%10 = phi i8* [ %4, %6 ], [ null, %1 ]
ret i8* %10
}
float logbf(float x) {
  float res;
  asm("fxtract\n\t"
      "fstp	%%st"
      : "=t"(res)
      : "0"(x));
  return res;
}


x86 assembly (clang, -O0):
<logbf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
flds   -0xc(%rbp)
fxtract
fstp   %st(0)
fstps  -0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<logbf>:
movss  %xmm0,-0x4(%rsp)
flds   -0x4(%rsp)
fxtract
fstp   %st(0)
fstps  -0x8(%rsp)
movss  -0x8(%rsp),%xmm0
ret

LLVM IR (-O0):
define float @logbf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float asm "fxtract\0A\09fstp\09%st", "={st},0,~{dirflag},~{fpsr},~{flags}"(float %4)
store float %5, float* %3
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @logbf(float %0) {
%2 = tail call float asm "fxtract\0A\09fstp\09%st", "={st},0,~{dirflag},~{fpsr},~{flags}"(float %0)
ret float %2
}
/* Variables and functions */
double _asinacos(double, int /*<<< orphan*/);
double asin(double x) { return _asinacos(x, 0); }


x86 assembly (clang, -O0):
<asin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xor    %edi,%edi
call   1030 <_asinacos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asin>:
xor    %edi,%edi
jmp    1030 <_asinacos@plt>

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

LLVM IR (-O2):
define double @asin(double %0) {
%2 = tail call double @_asinacos(double %0, i32 0)
ret double %2
}
long_pause() {
  long i;
  float a = 22.2, b = 334.4, c = 98.0;
  for (i = 0; i < 99999999; i++)
    a = b * c / a;
}


x86 assembly (clang, -O0):
<long_pause>:
push   %rbp
mov    %rsp,%rbp
movss  0xefc(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xeeb(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xeda(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x5f5e0ff,-0x10(%rbp)
05
jge    1166 <long_pause+0x66>
movss  -0x18(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1133 <long_pause+0x33>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @long_pause() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float 0x4036333340000000, float* %3
store float 0x4074E66660000000, float* %4
store float 9.800000e+01, float* %5
store i64 0, i64* %2
br label %6
6: ; preds = %15, %0
%7 = load i64, i64* %2
%8 = icmp slt i64 %7, 99999999
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load float, float* %4
%11 = load float, float* %5
%12 = fmul float %10, %11
%13 = load float, float* %3
%14 = fdiv float %12, %13
store float %14, float* %3
br label %15
15: ; preds = %9
%16 = load i64, i64* %2
%17 = add nsw i64 %16, 1
store i64 %17, i64* %2
br label %6
18: ; preds = %6
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @long_pause() {
ret i32 undef
}
void report_magnetic_raw_data(struct ssp_data *data, struct sensor_value *mag) {
  return;
}


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

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

LLVM IR (-O0):
%struct.ssp_data = type opaque
%struct.sensor_value = type opaque
define void @report_magnetic_raw_data(%struct.ssp_data* %0, %struct.sensor_value* %1) {
%3 = alloca %struct.ssp_data*
%4 = alloca %struct.sensor_value*
store %struct.ssp_data* %0, %struct.ssp_data** %3
store %struct.sensor_value* %1, %struct.sensor_value** %4
ret void
}

LLVM IR (-O2):
%struct.ssp_data = type opaque
%struct.sensor_value = type opaque
define void @report_magnetic_raw_data(%struct.ssp_data* nocapture %0, %struct.sensor_value* nocapture %1) {
ret void
}
int main() {
  char *p;
  p = "foobar";
  if (p[1] != 111)
    return 1;
  if (p[6] != 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    0xeee(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6f,%eax
je     1133 <main+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1157 <main+0x57>
mov    -0x10(%rbp),%rax
movsbl 0x6(%rax),%eax
cmp    $0x0,%eax
je     1150 <main+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1157 <main+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ blackstrap_log_debug(char *, char *);
char *blackstrap_stringify_msg_uchar(char const *, unsigned char);
int /*<<< orphan*/ free(char *);
void blackstrap_log_uchar_msg_value(const char *message, unsigned char value) {
  char *string = blackstrap_stringify_msg_uchar(message, value);
  if (!string)
    return;
  blackstrap_log_debug("%s", string);
  free(string);
}


x86 assembly (clang, -O0):
<blackstrap_log_uchar_msg_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
movzbl -0x9(%rbp),%esi
call   1050 <blackstrap_stringify_msg_uchar@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1163 <blackstrap_log_uchar_msg_value+0x33>
jmp    117c <blackstrap_log_uchar_msg_value+0x4c>
mov    -0x18(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1040 <blackstrap_log_debug@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blackstrap_log_uchar_msg_value>:
push   %rbx
call   1050 <blackstrap_stringify_msg_uchar@plt>
test   %rax,%rax
je     1156 <blackstrap_log_uchar_msg_value+0x26>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
mov    %rax,%rsi
call   1040 <blackstrap_log_debug@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @blackstrap_log_uchar_msg_value(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8*
store i8* %0, i8** %3
store i8 %1, i8* %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %4
%8 = call i8* @blackstrap_stringify_msg_uchar(i8* %6, i8 zeroext %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %2
br label %17
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @blackstrap_log_debug(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %5
%16 = call i32 @free(i8* %15)
br label %17
17: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @blackstrap_log_uchar_msg_value(i8* %0, i8 zeroext %1) {
%3 = tail call i8* @blackstrap_stringify_msg_uchar(i8* %0, i8 zeroext %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @blackstrap_log_debug(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = tail call i32 @free(i8* %3)
br label %8
8: ; preds = %2, %5
ret void
}
int test_imm_59uint16_mem(unsigned short *val) {
  return ((*val) & (-0x59 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_59uint16_mem>:
movzwl (%rdi),%eax
test   $0xffa7,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_59uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -89
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_EBuint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xEB << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_EBuint64_midword_reg>:
test   $0xeb0000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_EBuint64_midword_reg(i64 %0) {
%2 = and i64 %0, 15400960
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void copy(void) {
  int i;
  extern char longest[], line[];
  i = 0;
  while ((longest[i] = line[i]) != '\0')
    ++i;
}


x86 assembly (clang, -O0):
<copy>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
mov    0x2ed2(%rip),%rax
mov    (%rax,%rcx,1),%al
movslq -0x4(%rbp),%rdx
mov    0x2eb4(%rip),%rcx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     1141 <copy+0x41>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <copy+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy>:
xor    %eax,%eax
mov    0x2edf(%rip),%rsi
mov    0x2ec8(%rip),%rdx
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdx,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <copy+0x10>
ret

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

LLVM IR (-O2):
@line = external global [0 x i8]
@longest = external global [0 x i8]
define void @copy() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ %7, %1 ], [ 0, %0 ]
%3 = getelementptr inbounds [0 x i8], [0 x i8]* @line, i64 0, i64 %2
%4 = load i8, i8* %3
%5 = getelementptr inbounds [0 x i8], [0 x i8]* @longest, i64 0, i64 %2
store i8 %4, i8* %5
%6 = icmp eq i8 %4, 0
%7 = add nuw i64 %2, 1
br i1 %6, label %8, label %1
8: ; preds = %1
ret void
}
void addWithReference(int *num1, int *num2) {
  *num1 = 1000;
  *num2 = 2000;
}


x86 assembly (clang, -O0):
<addWithReference>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3e8,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x7d0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<addWithReference>:
movl   $0x3e8,(%rdi)
movl   $0x7d0,(%rsi)
ret

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

LLVM IR (-O2):
define void @addWithReference(i32* nocapture writeonly %0, i32* nocapture writeonly %1) {
store i32 1000, i32* %0
store i32 2000, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
char *strrchr(char *, char);
void read_input(char *buff, int buff_size) {
  char *eof;
  buff[0] = '\0';
  if (fgets(buff, buff_size, stdin) == NULL)
    return;
  if ((eof = strrchr(buff, '\n')) == NULL)
    return;
  eof[0] = '\0';
}


x86 assembly (clang, -O0):
<read_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2ea4(%rip),%rax
mov    (%rax),%edx
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    115a <read_input+0x3a>
jmp    1182 <read_input+0x62>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    117b <read_input+0x5b>
jmp    1182 <read_input+0x62>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_input>:
push   %rbx
mov    %rdi,%rbx
movb   $0x0,(%rdi)
mov    0x2eba(%rip),%rax
mov    (%rax),%edx
call   1040 <fgets@plt>
test   %rax,%rax
je     114f <read_input+0x2f>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     114f <read_input+0x2f>
movb   $0x0,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
define void @read_input(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 0, i8* %7
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = load i32, i32* @stdin
%11 = call i32* @fgets(i8* %8, i32 %9, i32 %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %14
13: ; preds = %2
br label %22
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = call i8* @strrchr(i8* %15, i8 signext 10)
store i8* %16, i8** %5
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %19
18: ; preds = %14
br label %22
19: ; preds = %14
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i64 0
store i8 0, i8* %21
br label %22
22: ; preds = %19, %18, %13
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @read_input(i8* %0, i32 %1) {
store i8 0, i8* %0
%3 = load i32, i32* @stdin
%4 = tail call i32* @fgets(i8* %0, i32 %1, i32 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i8* @strrchr(i8* %0, i8 signext 10)
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %6
store i8 0, i8* %7
br label %10
10: ; preds = %6, %2, %9
ret void
}
__attribute__((no)) int __getanum(int x, int y) { return (x + y) * y; }


x86 assembly (clang, -O0):
<__getanum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getanum>:
lea    (%rdi,%rsi,1),%eax
imul   %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @__getanum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = mul nsw i32 %3, %1
ret i32 %4
}
int __ocl_all_int(int src) { return (src >> (32 - 1)) & 0x1; }


x86 assembly (clang, -O0):
<__ocl_all_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_all_int>:
mov    %edi,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @__ocl_all_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 31
%5 = and i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @__ocl_all_int(i32 %0) {
%2 = lshr i32 %0, 31
ret i32 %2
}
void uart_putc(char c) {
  while (!(*((volatile unsigned long *)0xb04001b8) & 1))
    ;
  *((volatile unsigned long *)0xb04001bc) = c;
}


x86 assembly (clang, -O0):
<uart_putc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xb04001b8,%eax
mov    (%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112c <uart_putc+0x2c>
jmp    1131 <uart_putc+0x31>
jmp    110a <uart_putc+0xa>
movsbq -0x1(%rbp),%rcx
mov    $0xb04001bc,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_putc>:
mov    $0xb04001b8,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testq  $0x1,(%rax)
je     1110 <uart_putc+0x10>
movsbq %dil,%rcx
mov    %rcx,0x4(%rax)
ret

LLVM IR (-O0):
define void @uart_putc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %8, %1
%4 = load volatile i64, i64* inttoptr (i64 2956984760 to i64*)
%5 = and i64 %4, 1
%6 = icmp ne i64 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %9
8: ; preds = %3
br label %3
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i64
store volatile i64 %11, i64* inttoptr (i64 2956984764 to i64*)
ret void
}

LLVM IR (-O2):
define void @uart_putc(i8 signext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i64, i64* inttoptr (i64 2956984760 to i64*)
%4 = and i64 %3, 1
%5 = icmp eq i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = sext i8 %0 to i64
store volatile i64 %7, i64* inttoptr (i64 2956984764 to i64*)
ret void
}
int int_max(int x, int y) {
  if (x > y) {
    return x;
  } else {
    return y;
  }
}


x86 assembly (clang, -O0):
<int_max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1121 <int_max+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <int_max+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @int_max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
struct timeval {
  long long tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
long long tvdiff_usec(struct timeval *et, struct timeval *st) {
  long long usec;
  usec =
      ((long long)et->tv_sec) * 1000000LL - ((long long)st->tv_sec) * 1000000LL;
  return usec + (et->tv_usec - st->tv_usec);
}


x86 assembly (clang, -O0):
<tvdiff_usec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xf4240,0x8(%rax),%rax
mov    -0x10(%rbp),%rcx
imul   $0xf4240,0x8(%rcx),%rcx
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
mov    -0x10(%rbp),%rdx
sub    (%rdx),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tvdiff_usec>:
mov    (%rdi),%rax
mov    0x8(%rdi),%rcx
sub    0x8(%rsi),%rcx
imul   $0xf4240,%rcx,%rcx
sub    (%rsi),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @tvdiff_usec(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
%5 = alloca i64
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timeval* %1, %struct.timeval** %4
%6 = load %struct.timeval*, %struct.timeval** %3
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%8 = load i64, i64* %7
%9 = mul nsw i64 %8, 1000000
%10 = load %struct.timeval*, %struct.timeval** %4
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
%12 = load i64, i64* %11
%13 = mul nsw i64 %12, 1000000
%14 = sub nsw i64 %9, %13
store i64 %14, i64* %5
%15 = load i64, i64* %5
%16 = load %struct.timeval*, %struct.timeval** %3
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 0
%18 = load i64, i64* %17
%19 = load %struct.timeval*, %struct.timeval** %4
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 0
%21 = load i64, i64* %20
%22 = sub nsw i64 %18, %21
%23 = add nsw i64 %15, %22
ret i64 %23
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @tvdiff_usec(%struct.timeval* nocapture %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = sub i64 %4, %6
%12 = mul i64 %11, 1000000
%13 = sub i64 %8, %10
%14 = add i64 %13, %12
ret i64 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ wcstoll(int /*<<< orphan*/ const *, int /*<<< orphan*/ **,
                           int);
int64_t _wtoi64(const wchar_t *w) {
  wchar_t *endptr = 0;
  return wcstoll(w, &endptr, 10);
}


x86 assembly (clang, -O0):
<_wtoi64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0xa,%edx
call   1030 <wcstoll@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_wtoi64>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <wcstoll@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_wtoi64(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
store i32* null, i32** %3
%4 = load i32*, i32** %2
%5 = call i32 @wcstoll(i32* %4, i32** %3, i32 10)
ret i32 %5
}

LLVM IR (-O2):
define i32 @_wtoi64(i32* %0) {
%2 = alloca i32*
%3 = bitcast i32** %2 to i8*
store i32* null, i32** %2
%4 = call i32 @wcstoll(i32* %0, i32** %2, i32 10)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = 0;
  int a[2] = {0, 1};
  for (i = 2; i < 10000; i++) {
    a[i] = i;
    printf("i=%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    116d <main+0x5d>
mov    -0x8(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x10(%rbp,%rax,4)
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1138 <main+0x28>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x2710,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"i=%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 2, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 10000
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char **);
int /*<<< orphan*/ sqlite_freemem(char *);
void db_query_free(char **az) {
  int i;
  for (i = 0; az[i]; i++) {
    sqlite_freemem(az[i]);
  }
  free(az);
}


x86 assembly (clang, -O0):
<db_query_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1165 <db_query_free+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <sqlite_freemem@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <db_query_free+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_query_free>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1151 <db_query_free+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1040 <sqlite_freemem@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1140 <db_query_free+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @db_query_free(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %18, %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 = icmp ne i8* %9, null
br i1 %10, label %11, label %21
11: ; preds = %4
%12 = load i8**, i8*** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @sqlite_freemem(i8* %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
%22 = load i8**, i8*** %2
%23 = call i32 @free(i8** %22)
ret void
}

LLVM IR (-O2):
define void @db_query_free(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @sqlite_freemem(i8* %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = tail call i32 @free(i8** %0)
ret void
}
/* Variables and functions */
int wcwidth(int const);
int output_width(const int c) {
  const int width = wcwidth(c);
  return width > 0 ? width : 1;
}


x86 assembly (clang, -O0):
<output_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <wcwidth@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    113b <output_width+0x2b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <output_width+0x38>
mov    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <output_width+0x38>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_width>:
push   %rax
call   1030 <wcwidth@plt>
test   %eax,%eax
mov    $0x1,%ecx
cmovle %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @output_width(i32 %0) {
%2 = tail call i32 @wcwidth(i32 %0)
%3 = icmp sgt i32 %2, 1
%4 = select i1 %3, i32 %2, i32 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ log_open(char *);
int /*<<< orphan*/ log_write(int, char *, int, char *);
int main() {
  log_open("log.txt");
  log_write(3,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/prikevs/KevChat/refs/heads/master/tests/"
            "demo_logger.c",
            6, "just a test");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <log_open@plt>
mov    $0x3,%edi
lea    0xec1(%rip),%rsi
mov    $0x6,%edx
lea    0xf45(%rip),%rcx
call   1040 <log_write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <log_open@plt>
lea    0xed4(%rip),%rsi
lea    0xf5d(%rip),%rcx
mov    $0x3,%edi
mov    $0x6,%edx
call   1040 <log_write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"log.txt\00"
@.str.1 = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/prikevs/KevChat/refs/heads/master/tests/demo_logger.c\00"
@.str.2 = [12 x i8] c"just a test\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @log_open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @log_write(i32 3, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.1, i64 0, i64 0), i32 6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"log.txt\00"
@.str.1 = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/prikevs/KevChat/refs/heads/master/tests/demo_logger.c\00"
@.str.2 = [12 x i8] c"just a test\00"
define i32 @main() {
%1 = tail call i32 @log_open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @log_write(i32 3, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.1, i64 0, i64 0), i32 6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ltrim(char *);
void skipstr(char **line) {
  ltrim(*line);
  while ((*line[0] != ' ') && (*line[0] != '\0'))
    (*line)++;
}


x86 assembly (clang, -O0):
<skipstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <ltrim@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     1153 <skipstr+0x43>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1163 <skipstr+0x53>
jmp    1176 <skipstr+0x66>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1128 <skipstr+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipstr>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <ltrim@plt>
mov    (%rbx),%rax
nop
add    $0x1,%rax
testb  $0xdf,-0x1(%rax)
je     112f <skipstr+0x1f>
mov    %rax,(%rbx)
jmp    1120 <skipstr+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @skipstr(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @ltrim(i8* %2)
%4 = load i8*, i8** %0
br label %5
5: ; preds = %8, %1
%6 = phi i8* [ %9, %8 ], [ %4, %1 ]
%7 = load i8, i8* %6
switch i8 %7, label %8 [
i8 32, label %10
i8 0, label %10
]
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %9, i8** %0
br label %5
10: ; preds = %5, %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ book2strbook(int /*<<< orphan*/, char *);
int /*<<< orphan*/ init_set_random_book(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
void set_random_strbook(char *strbook) {
  mpz_t book;
  init_set_random_book(book);
  book2strbook(book, strbook);
  mpz_clear(book);
}


x86 assembly (clang, -O0):
<set_random_strbook>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <init_set_random_book@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <book2strbook@plt>
mov    -0xc(%rbp),%edi
call   1040 <mpz_clear@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_random_strbook>:
push   %rbx
mov    %rdi,%rbx
call   1050 <init_set_random_book@plt>
mov    %rbx,%rsi
call   1030 <book2strbook@plt>
pop    %rbx
jmp    1040 <mpz_clear@plt>

LLVM IR (-O0):
define void @set_random_strbook(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* %3
%5 = call i32 @init_set_random_book(i32 %4)
%6 = load i32, i32* %3
%7 = load i8*, i8** %2
%8 = call i32 @book2strbook(i32 %6, i8* %7)
%9 = load i32, i32* %3
%10 = call i32 @mpz_clear(i32 %9)
ret void
}

LLVM IR (-O2):
define void @set_random_strbook(i8* %0) {
%2 = tail call i32 @init_set_random_book(i32 undef)
%3 = tail call i32 @book2strbook(i32 undef, i8* %0)
%4 = tail call i32 @mpz_clear(i32 undef)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ i2c_read(int, int, int, int *);
int16_t mpl3115_get_temp(int fd) {
  uint8_t th, tl;
  i2c_read(fd, 0x60, 0x04, &th);
  i2c_read(fd, 0x60, 0x05, &tl);
  return (th * 10 + (tl >> 4) * 0.625);
}


x86 assembly (clang, -O0):
<mpl3115_get_temp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x60,%esi
mov    $0x4,%edx
lea    -0x8(%rbp),%rcx
call   1030 <i2c_read@plt>
mov    -0x4(%rbp),%edi
mov    $0x60,%esi
mov    $0x5,%edx
lea    -0xc(%rbp),%rcx
call   1030 <i2c_read@plt>
imul   $0xa,-0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
mov    -0xc(%rbp),%eax
sar    $0x4,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe9f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpl3115_get_temp>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xc(%rsp),%rcx
mov    $0x60,%esi
mov    $0x4,%edx
call   1030 <i2c_read@plt>
lea    0x8(%rsp),%rcx
mov    %ebx,%edi
mov    $0x60,%esi
mov    $0x5,%edx
call   1030 <i2c_read@plt>
mov    0xc(%rsp),%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
cvtsi2sd %eax,%xmm0
mov    0x8(%rsp),%eax
sar    $0x4,%eax
cvtsi2sd %eax,%xmm1
mulsd  0xe9f(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mpl3115_get_temp(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @i2c_read(i32 %5, i32 96, i32 4, i32* %3)
%7 = load i32, i32* %2
%8 = call i32 @i2c_read(i32 %7, i32 96, i32 5, i32* %4)
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 10
%11 = sitofp i32 %10 to double
%12 = load i32, i32* %4
%13 = ashr i32 %12, 4
%14 = sitofp i32 %13 to double
%15 = call double @llvm.fmuladd.f64(double %14, double 6.250000e-01, double %11)
%16 = fptosi double %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @mpl3115_get_temp(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @i2c_read(i32 %0, i32 96, i32 4, i32* %2)
%7 = call i32 @i2c_read(i32 %0, i32 96, i32 5, i32* %3)
%8 = load i32, i32* %2
%9 = mul nsw i32 %8, 10
%10 = sitofp i32 %9 to double
%11 = load i32, i32* %3
%12 = ashr i32 %11, 4
%13 = sitofp i32 %12 to double
%14 = call double @llvm.fmuladd.f64(double %13, double 6.250000e-01, double %10)
%15 = fptosi double %14 to i32
ret i32 %15
}
/* Variables and functions */
int writeToCompassDevice(int, int);
int setCompassConfigurationRegisterA(int mode) {
  return writeToCompassDevice(0x00, mode);
}


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

x86 assembly (clang, -O2):
<setCompassConfigurationRegisterA>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <writeToCompassDevice@plt>

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

LLVM IR (-O2):
define i32 @setCompassConfigurationRegisterA(i32 %0) {
%2 = tail call i32 @writeToCompassDevice(i32 0, i32 %0)
ret i32 %2
}
char *RCSid() {
  return RCSid("$Id: doc2ms.c,v 1.19 2007/10/24 00:47:51 sfeam Exp $");
}


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

x86 assembly (clang, -O2):
<RCSid>:
jmp    1100 <RCSid>

LLVM IR (-O0):
@.str = [53 x i8] c"$Id: doc2ms.c,v 1.19 2007/10/24 00:47:51 sfeam Exp $\00"
define i8* @RCSid() {
%1 = call i8* (i8*, ...) bitcast (i8* ()* @RCSid to i8* (i8*, ...)*)(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
define noalias i8* @RCSid() {
br label %1
1: ; preds = %1, %0
br label %1
}
void RTManifestEntrySetAttr(void) {}


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

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

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

LLVM IR (-O2):
define void @RTManifestEntrySetAttr() {
ret void
}