xunge/DecIR huggingface dataset:
void av_rescale_q() {}


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

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

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

LLVM IR (-O2):
define void @av_rescale_q() {
ret void
}
int llz_blackman_cof_num(double ftrans) { return (int)(6.6 / ftrans); }


x86 assembly (clang, -O0):
<llz_blackman_cof_num>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llz_blackman_cof_num>:
movsd  0xef8(%rip),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
ret

LLVM IR (-O0):
define i32 @llz_blackman_cof_num(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double 6.600000e+00, %3
%5 = fptosi double %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @llz_blackman_cof_num(double %0) {
%2 = fdiv double 6.600000e+00, %0
%3 = fptosi double %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x52() {
  Assert_real((isdigit(82) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              415, ("isdigit should be 0 for R"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x52>:
push   %rbp
mov    %rsp,%rbp
mov    $0x52,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x19f,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x52>:
push   %rax
mov    $0x52,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x19f,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for R\00"
define void @t_isdigit_0x52() {
%1 = call i64 @isdigit(i32 82)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 415, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for R\00"
define void @t_isdigit_0x52() {
%1 = tail call i64 @isdigit(i32 82)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 415, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ GLUE_SET_WTP_FROM_R17;

/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned int const *, int);
int GLUE_RESET_WTP(unsigned char *out, void *ptr) {
  const static unsigned int GLUE_SET_WTP_FROM_R17 = 0x7E308B78;
  if (out)
    memcpy(out, &GLUE_SET_WTP_FROM_R17, sizeof(GLUE_SET_WTP_FROM_R17));
  return sizeof(GLUE_SET_WTP_FROM_R17);
}


x86 assembly (clang, -O0):
<GLUE_RESET_WTP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1140 <GLUE_RESET_WTP+0x30>
mov    -0x8(%rbp),%rdi
lea    0xeca(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    $0x4,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GLUE_RESET_WTP>:
test   %rdi,%rdi
je     112b <GLUE_RESET_WTP+0x1b>
push   %rax
lea    0xee3(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
add    $0x8,%rsp
mov    $0x4,%eax
ret

LLVM IR (-O0):
@GLUE_RESET_WTP.GLUE_SET_WTP_FROM_R17 = internal constant i32 2117110648
define i32 @GLUE_RESET_WTP(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @memcpy(i8* %8, i32* @GLUE_RESET_WTP.GLUE_SET_WTP_FROM_R17, i32 4)
br label %10
10: ; preds = %7, %2
ret i32 4
}

LLVM IR (-O2):
@GLUE_RESET_WTP.GLUE_SET_WTP_FROM_R17 = internal constant i32 2117110648
define i32 @GLUE_RESET_WTP(i8* %0, i8* nocapture readnone %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @memcpy(i8* %0, i32* @GLUE_RESET_WTP.GLUE_SET_WTP_FROM_R17, i32 4)
br label %6
6: ; preds = %4, %2
ret i32 4
}
/* Type definitions */
struct crk5_obj_dev {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct crk5_obj_dev *);
void crk5_obj_dev_delete(struct crk5_obj_dev *obj) {
  if (!obj)
    return;
  free(obj);
}


x86 assembly (clang, -O0):
<crk5_obj_dev_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <crk5_obj_dev_delete+0x1c>
jmp    1135 <crk5_obj_dev_delete+0x25>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crk5_obj_dev_delete>:
test   %rdi,%rdi
je     111a <crk5_obj_dev_delete+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
%struct.crk5_obj_dev = type { i32 }
define void @crk5_obj_dev_delete(%struct.crk5_obj_dev* %0) {
%2 = alloca %struct.crk5_obj_dev*
store %struct.crk5_obj_dev* %0, %struct.crk5_obj_dev** %2
%3 = load %struct.crk5_obj_dev*, %struct.crk5_obj_dev** %2
%4 = icmp ne %struct.crk5_obj_dev* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load %struct.crk5_obj_dev*, %struct.crk5_obj_dev** %2
%8 = call i32 @free(%struct.crk5_obj_dev* %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
%struct.crk5_obj_dev = type { i32 }
define void @crk5_obj_dev_delete(%struct.crk5_obj_dev* %0) {
%2 = icmp eq %struct.crk5_obj_dev* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.crk5_obj_dev* %0)
br label %5
5: ; preds = %1, %3
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ msec_to_nsec(unsigned long);
int /*<<< orphan*/ ts_add_nsec(struct timespec *, int /*<<< orphan*/);
void ts_add_msec(struct timespec *ts, unsigned long msec) {
  ts_add_nsec(ts, msec_to_nsec(msec));
}


x86 assembly (clang, -O0):
<ts_add_msec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <msec_to_nsec@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <ts_add_nsec@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_add_msec>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <msec_to_nsec@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <ts_add_nsec@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
define void @ts_add_msec(%struct.timespec* %0, i64 %1) {
%3 = alloca %struct.timespec*
%4 = alloca i64
store %struct.timespec* %0, %struct.timespec** %3
store i64 %1, i64* %4
%5 = load %struct.timespec*, %struct.timespec** %3
%6 = load i64, i64* %4
%7 = call i32 @msec_to_nsec(i64 %6)
%8 = call i32 @ts_add_nsec(%struct.timespec* %5, i32 %7)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define void @ts_add_msec(%struct.timespec* %0, i64 %1) {
%3 = tail call i32 @msec_to_nsec(i64 %1)
%4 = tail call i32 @ts_add_nsec(%struct.timespec* %0, i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fmax(double, double);
float fmin(int /*<<< orphan*/, double);
int fscanf(int /*<<< orphan*/ *, char *, double *);
bool read_volume(FILE *file, float *out) {
  double value;
  if (fscanf(file, "=%lf ", &value) < 1)
    return false;
  *out = fmin(fmax(0.0, value), 1.0);
  return true;
}


x86 assembly (clang, -O0):
<read_volume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xebd(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jge    1169 <read_volume+0x39>
movl   $0x0,-0x4(%rbp)
jmp    1194 <read_volume+0x64>
movsd  -0x20(%rbp),%xmm1
xorps  %xmm0,%xmm0
call   1050 <fmax@plt>
mov    %eax,%edi
movsd  0xe80(%rip),%xmm0
call   1040 <fmin@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_volume>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xec9(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1030 <fscanf@plt>
test   %eax,%eax
jle    1175 <read_volume+0x45>
movsd  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
call   1050 <fmax@plt>
movsd  0xe9d(%rip),%xmm0
mov    %eax,%edi
call   1040 <fmin@plt>
movss  %xmm0,(%rbx)
mov    $0x1,%eax
jmp    1177 <read_volume+0x47>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"=%lf \00"
define i32 @read_volume(i32* %0, float* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca float*
%6 = alloca double
store i32* %0, i32** %4
store float* %1, float** %5
%7 = load i32*, i32** %4
%8 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double* %6)
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %16
11: ; preds = %2
%12 = load double, double* %6
%13 = call i32 @fmax(double 0.000000e+00, double %12)
%14 = call float @fmin(i32 %13, double 1.000000e+00)
%15 = load float*, float** %5
store float %14, float* %15
store i32 1, i32* %3
br label %16
16: ; preds = %11, %10
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [6 x i8] c"=%lf \00"
define i32 @read_volume(i32* nocapture %0, float* nocapture writeonly %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double* %3)
%6 = icmp slt i32 %5, 1
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = load double, double* %3
%9 = call i32 @fmax(double 0.000000e+00, double %8)
%10 = call float @fmin(i32 %9, double 1.000000e+00)
store float %10, float* %1
br label %11
11: ; preds = %2, %7
%12 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %12
}
/* Variables and functions */
scalar_t__ E2BIG;
int /*<<< orphan*/ IPC_NOWAIT;
scalar_t__ errno;
int msgrcv(int, int /*<<< orphan*/ *, int /*<<< orphan*/, long,
           int /*<<< orphan*/);
int peek_message(int qid, long type) {
  int result, length;
  if ((result = msgrcv(qid, NULL, 0, type, IPC_NOWAIT)) == -1) {
    if (errno == E2BIG)
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<peek_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rcx
mov    0x2ec3(%rip),%rax
mov    (%rax),%r8d
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <msgrcv@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1172 <peek_message+0x62>
mov    0x2e82(%rip),%rax
mov    (%rax),%rax
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
jne    116d <peek_message+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    1179 <peek_message+0x69>
jmp    1172 <peek_message+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<peek_message>:
push   %rax
mov    %rsi,%rcx
mov    0x2ed5(%rip),%rax
mov    (%rax),%r8d
xor    %esi,%esi
xor    %edx,%edx
call   1030 <msgrcv@plt>
cmp    $0xffffffff,%eax
jne    1147 <peek_message+0x37>
mov    0x2e9d(%rip),%rax
mov    (%rax),%rcx
mov    0x2ea3(%rip),%rdx
mov    $0x1,%eax
cmp    (%rdx),%rcx
je     1149 <peek_message+0x39>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@IPC_NOWAIT = global i32 0
@errno = global i64 0
@E2BIG = global i64 0
define i32 @peek_message(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i64 %1, i64* %5
%8 = load i32, i32* %4
%9 = load i64, i64* %5
%10 = load i32, i32* @IPC_NOWAIT
%11 = call i32 @msgrcv(i32 %8, i32* null, i32 0, i64 %9, i32 %10)
store i32 %11, i32* %6
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i64, i64* @errno
%15 = load i64, i64* @E2BIG
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %3
br label %20
18: ; preds = %13
br label %19
19: ; preds = %18, %2
store i32 0, i32* %3
br label %20
20: ; preds = %19, %17
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@IPC_NOWAIT = global i32 0
@errno = global i64 0
@E2BIG = global i64 0
define i32 @peek_message(i32 %0, i64 %1) {
%3 = load i32, i32* @IPC_NOWAIT
%4 = tail call i32 @msgrcv(i32 %0, i32* null, i32 0, i64 %1, i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i64, i64* @errno
%8 = load i64, i64* @E2BIG
%9 = icmp eq i64 %7, %8
br i1 %9, label %11, label %10
10: ; preds = %6, %2
br label %11
11: ; preds = %6, %10
%12 = phi i32 [ 0, %10 ], [ 1, %6 ]
ret i32 %12
}
/* Variables and functions */
char tolower(char);
void strlwr(char *string) {
  int i;
  i = 0;
  while (string[i]) {
    string[i] = tolower(string[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<strlwr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1161 <strlwr+0x51>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <strlwr+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlwr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <strlwr+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <strlwr+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @strlwr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %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, 0
br i1 %10, label %11, label %24
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 signext i8 @tolower(i8 signext %16)
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %4
24: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @strlwr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call signext i8 @tolower(i8 signext %6)
store i8 %8, i8* %7
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ INS_0F();
int /*<<< orphan*/ _c_setbyte(int);
void PUSH_FS() {
  ;
  INS_0F();
  _c_setbyte(0xa0);
  ;
}


x86 assembly (clang, -O0):
<PUSH_FS>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <INS_0F@plt>
mov    $0xa0,%edi
call   1040 <_c_setbyte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PUSH_FS>:
push   %rax
xor    %eax,%eax
call   1030 <INS_0F@plt>
mov    $0xa0,%edi
pop    %rax
jmp    1040 <_c_setbyte@plt>

LLVM IR (-O0):
define void @PUSH_FS() {
%1 = call i32 (...) @INS_0F()
%2 = call i32 @_c_setbyte(i32 160)
ret void
}

LLVM IR (-O2):
define void @PUSH_FS() {
%1 = tail call i32 (...) @INS_0F()
%2 = tail call i32 @_c_setbyte(i32 160)
ret void
}
/* Variables and functions */
int distinct_chars(char const *);
int lexicographic_sort(char const *, char const *);
int sort_by_number_of_distinct_characters(const char *a, const char *b) {
  int res = distinct_chars(a) - distinct_chars(b);
  return res ? res : lexicographic_sort(a, b);
}


x86 assembly (clang, -O0):
<sort_by_number_of_distinct_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <distinct_chars@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <distinct_chars@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1164 <sort_by_number_of_distinct_characters+0x44>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1174 <sort_by_number_of_distinct_characters+0x54>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <lexicographic_sort@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort_by_number_of_distinct_characters>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <distinct_chars@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <distinct_chars@plt>
sub    %eax,%ebp
je     1144 <sort_by_number_of_distinct_characters+0x24>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <lexicographic_sort@plt>

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

LLVM IR (-O2):
define i32 @sort_by_number_of_distinct_characters(i8* %0, i8* %1) {
%3 = tail call i32 @distinct_chars(i8* %0)
%4 = tail call i32 @distinct_chars(i8* %1)
%5 = sub nsw i32 %3, %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @lexicographic_sort(i8* %0, i8* %1)
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ %8, %7 ], [ %5, %2 ]
ret i32 %10
}
/* Type definitions */
struct bgp_node {
  int dummy;
};
struct bgp_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bgp_reg_dereg_for_label(struct bgp_node *, struct bgp_info *,
                                           int);
void bgp_register_for_label(struct bgp_node *rn, struct bgp_info *ri) {
  bgp_reg_dereg_for_label(rn, ri, 1);
}


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

x86 assembly (clang, -O2):
<bgp_register_for_label>:
mov    $0x1,%edx
jmp    1030 <bgp_reg_dereg_for_label@plt>

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

LLVM IR (-O2):
%struct.bgp_node = type { i32 }
%struct.bgp_info = type { i32 }
define void @bgp_register_for_label(%struct.bgp_node* %0, %struct.bgp_info* %1) {
%3 = tail call i32 @bgp_reg_dereg_for_label(%struct.bgp_node* %0, %struct.bgp_info* %1, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ testX();
int main(int argc, char **argv) {
  testX();
  return 1;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @testX()
ret i32 1
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @testX()
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int ban = 1;
  int win = 1;
  if (ban == win)
    printf("Win....:");
  else
    printf(":(");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    114a <main+0x3a>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
jmp    1156 <main+0x46>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"Win....:\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void popcnt_w64_prim() {
  __asm__("popcnt %%rbx, %%rbx\n\t"
          "jmp * (%%rbp)\n\t" ::
              :);
}


x86 assembly (clang, -O0):
<popcnt_w64_prim>:
push   %rbp
mov    %rsp,%rbp
popcnt %rbx,%rbx
jmp    *0x0(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcnt_w64_prim>:
popcnt %rbx,%rbx
jmp    *0x0(%rbp)
ret

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

LLVM IR (-O2):
define void @popcnt_w64_prim() {
tail call void asm sideeffect "popcnt %rbx, %rbx\0A\09jmp * (%rbp)\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void add_binding() {}


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

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

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

LLVM IR (-O2):
define void @add_binding() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *ta_oom_p(void *p) {
  if (!p)
    abort();
  return p;
}


x86 assembly (clang, -O0):
<ta_oom_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112e <ta_oom_p+0x1e>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ta_oom_p>:
test   %rdi,%rdi
je     1119 <ta_oom_p+0x9>
mov    %rdi,%rax
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @ta_oom_p(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
define i8* @ta_oom_p(i8* readnone returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret i8* %0
}
int test_imm_3Duint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x3D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_3Duint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 61
%7 = icmp ne i64 %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_3Duint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 3997696
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int r;
  printf("Enter the exit status value %c ", 16);
  scanf("%d", &r);
  return r;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Enter the exit status value %c \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 16)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
@.str = [32 x i8] c"Enter the exit status value %c \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 16)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
void SteamAPI_ISteamInventory_SendItemDropHeartbeat(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


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

x86 assembly (clang, -O2):
<SteamAPI_ISteamInventory_SendItemDropHeartbeat>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamInventory_SendItemDropHeartbeat = [47 x i8] c"SteamAPI_ISteamInventory_SendItemDropHeartbeat\00"
define void @SteamAPI_ISteamInventory_SendItemDropHeartbeat(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__func__.SteamAPI_ISteamInventory_SendItemDropHeartbeat, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamInventory_SendItemDropHeartbeat = [47 x i8] c"SteamAPI_ISteamInventory_SendItemDropHeartbeat\00"
define void @SteamAPI_ISteamInventory_SendItemDropHeartbeat(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__func__.SteamAPI_ISteamInventory_SendItemDropHeartbeat, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
void *memcpy_backward(void *, void const *, unsigned int);
void *memcpy_forward(void *, void const *, unsigned int);
void *memmove(void *dst, const void *src, unsigned size) {
  if (src >= dst)
    return memcpy_forward(dst, src, size);
  else
    return memcpy_backward(dst, src, size);
}


x86 assembly (clang, -O0):
<memmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     115a <memmove+0x3a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcpy_forward@plt>
mov    %rax,-0x8(%rbp)
jmp    116e <memmove+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <memcpy_backward@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memmove>:
cmp    %rdi,%rsi
jae    112a <memmove+0xa>
jmp    1040 <memcpy_backward@plt>
jmp    1030 <memcpy_forward@plt>

LLVM IR (-O0):
define i8* @memmove(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %6
%9 = load i8*, i8** %5
%10 = icmp uge i8* %8, %9
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = call i8* @memcpy_forward(i8* %12, i8* %13, i32 %14)
store i8* %15, i8** %4
br label %21
16: ; preds = %3
%17 = load i8*, i8** %5
%18 = load i8*, i8** %6
%19 = load i32, i32* %7
%20 = call i8* @memcpy_backward(i8* %17, i8* %18, i32 %19)
store i8* %20, i8** %4
br label %21
21: ; preds = %16, %11
%22 = load i8*, i8** %4
ret i8* %22
}

LLVM IR (-O2):
define i8* @memmove(i8* %0, i8* %1, i32 %2) {
%4 = icmp ult i8* %1, %0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i8* @memcpy_forward(i8* %0, i8* %1, i32 %2)
br label %9
7: ; preds = %3
%8 = tail call i8* @memcpy_backward(i8* %0, i8* %1, i32 %2)
br label %9
9: ; preds = %7, %5
%10 = phi i8* [ %6, %5 ], [ %8, %7 ]
ret i8* %10
}
void bar(int y) {
  static int z;
  int k;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
@bar.z = internal global i32 0
define void @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @bar(i32 %0) {
ret void
}
void handle_help(int fd) {}


x86 assembly (clang, -O0):
<handle_help>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @handle_help(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @handle_help(i32 %0) {
ret void
}
/* Variables and functions */
int mkstemp(char *);
int bsdconv_mkstemp(char *template) { return mkstemp(template); }


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

x86 assembly (clang, -O2):
<bsdconv_mkstemp>:
jmp    1030 <mkstemp@plt>

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

LLVM IR (-O2):
define i32 @bsdconv_mkstemp(i8* %0) {
%2 = tail call i32 @mkstemp(i8* %0)
ret i32 %2
}
int test_set(int reg, int bit) {
  if (reg & (1 << bit))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<test_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1130 <test_set+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <test_set+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_set>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @test_set(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 = shl i32 1, %7
%9 = and i32 %6, %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @test_set(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int cmp_int(const void *x, const void *y) {
  assert(x != NULL && y != NULL);
  return *(const int *)x - *(const int *)y;
}


x86 assembly (clang, -O0):
<cmp_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     113b <cmp_int+0x2b>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_int>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    (%rbx),%eax
sub    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @cmp_int(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i8*, i8** %3
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = load i8*, i8** %4
%18 = bitcast i8* %17 to i32*
%19 = load i32, i32* %18
%20 = sub nsw i32 %16, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @cmp_int(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = bitcast i8* %0 to i32*
%9 = load i32, i32* %8
%10 = bitcast i8* %1 to i32*
%11 = load i32, i32* %10
%12 = sub nsw i32 %9, %11
ret i32 %12
}
int int_to_d16(int x) { return x << 16; }


x86 assembly (clang, -O0):
<int_to_d16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x10,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_to_d16>:
mov    %edi,%eax
shl    $0x10,%eax
ret

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

LLVM IR (-O2):
define i32 @int_to_d16(i32 %0) {
%2 = shl i32 %0, 16
ret i32 %2
}
char *get_buffer(void) {
  static char b[8][256];
  static int cb;
  if (++cb >= 8)
    cb = 0;
  return b[cb];
}


x86 assembly (clang, -O0):
<get_buffer>:
push   %rbp
mov    %rsp,%rbp
mov    0x3726(%rip),%eax
add    $0x1,%eax
mov    %eax,0x371d(%rip)
cmp    $0x8,%eax
jl     1126 <get_buffer+0x26>
movl   $0x0,0x370a(%rip)
movslq 0x3703(%rip),%rcx
lea    0x2efc(%rip),%rax
shl    $0x8,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_buffer>:
mov    0x372a(%rip),%eax
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x7,%eax
cmovl  %ecx,%edx
mov    %edx,0x3719(%rip)
movslq %edx,%rcx
shl    $0x8,%rcx
lea    0x2f0b(%rip),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@get_buffer.b = internal global [8 x [256 x i8]] zeroinitializer
@get_buffer.cb = internal global i32 0
define i8* @get_buffer() {
%1 = load i32, i32* @get_buffer.cb
%2 = add nsw i32 %1, 1
store i32 %2, i32* @get_buffer.cb
%3 = icmp sge i32 %2, 8
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 0, i32* @get_buffer.cb
br label %5
5: ; preds = %4, %0
%6 = load i32, i32* @get_buffer.cb
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [8 x [256 x i8]], [8 x [256 x i8]]* @get_buffer.b, i64 0, i64 %7
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
ret i8* %9
}

LLVM IR (-O2):
@get_buffer.b = internal global [8 x [256 x i8]] zeroinitializer
@get_buffer.cb = internal unnamed_addr global i32 0
define i8* @get_buffer() {
%1 = load i32, i32* @get_buffer.cb
%2 = add nsw i32 %1, 1
%3 = icmp sgt i32 %1, 6
%4 = select i1 %3, i32 0, i32 %2
store i32 %4, i32* @get_buffer.cb
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [8 x [256 x i8]], [8 x [256 x i8]]* @get_buffer.b, i64 0, i64 %5, i64 0
ret i8* %6
}
/* Variables and functions */
int rand();
int random_num(int max) {
  int r = rand() % max;
  return r;
}


x86 assembly (clang, -O0):
<random_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_num>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @random_num(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @rand()
%5 = load i32, i32* %2
%6 = srem i32 %4, %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @random_num(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ hog();
int /*<<< orphan*/ waitall();
int main() {
  hog();
  hog();
  hog();
  hog();
  hog();
  hog();
  waitall();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @hog()
%3 = call i32 (...) @hog()
%4 = call i32 (...) @hog()
%5 = call i32 (...) @hog()
%6 = call i32 (...) @hog()
%7 = call i32 (...) @hog()
%8 = call i32 (...) @waitall()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @hog()
%2 = tail call i32 (...) @hog()
%3 = tail call i32 (...) @hog()
%4 = tail call i32 (...) @hog()
%5 = tail call i32 (...) @hog()
%6 = tail call i32 (...) @hog()
%7 = tail call i32 (...) @waitall()
ret i32 0
}
unsigned get_alignment(unsigned pitch) {
  if (pitch & 1)
    return 1;
  if (pitch & 2)
    return 2;
  if (pitch & 4)
    return 4;
  return 8;
}


x86 assembly (clang, -O0):
<get_alignment>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1122 <get_alignment+0x22>
movl   $0x1,-0x4(%rbp)
jmp    115f <get_alignment+0x5f>
mov    -0x8(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     113d <get_alignment+0x3d>
movl   $0x2,-0x4(%rbp)
jmp    115f <get_alignment+0x5f>
mov    -0x8(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1158 <get_alignment+0x58>
movl   $0x4,-0x4(%rbp)
jmp    115f <get_alignment+0x5f>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_alignment>:
mov    $0x1,%eax
test   $0x1,%dil
jne    1126 <get_alignment+0x26>
mov    $0x2,%eax
test   $0x2,%dil
jne    1126 <get_alignment+0x26>
xor    %eax,%eax
test   $0x4,%dil
sete   %al
lea    0x4(,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @get_alignment(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %19
8: ; preds = %1
%9 = load i32, i32* %3
%10 = and i32 %9, 2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 2, i32* %2
br label %19
13: ; preds = %8
%14 = load i32, i32* %3
%15 = and i32 %14, 4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 4, i32* %2
br label %19
18: ; preds = %13
store i32 8, i32* %2
br label %19
19: ; preds = %18, %17, %12, %7
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @get_alignment(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = and i32 %0, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = and i32 %0, 4
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 8, i32 4
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %1 ], [ 2, %4 ], [ %10, %7 ]
ret i32 %12
}
int cpy_bmp(unsigned long value, void *arg) {
  unsigned char **p, *q;
  p = arg;
  q = *p;
  *q++ = (value >> 8) & 0xff;
  *q = value & 0xff;
  *p += 2;
  return 1;
}


x86 assembly (clang, -O0):
<cpy_bmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    %rcx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpy_bmp>:
mov    (%rsi),%rax
rol    $0x8,%di
mov    %di,(%rax)
addq   $0x2,(%rsi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @cpy_bmp(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8**, i8*** %5
%10 = load i8*, i8** %9
store i8* %10, i8** %6
%11 = load i64, i64* %3
%12 = lshr i64 %11, 8
%13 = and i64 %12, 255
%14 = trunc i64 %13 to i8
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %6
store i8 %14, i8* %15
%17 = load i64, i64* %3
%18 = and i64 %17, 255
%19 = trunc i64 %18 to i8
%20 = load i8*, i8** %6
store i8 %19, i8* %20
%21 = load i8**, i8*** %5
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 2
store i8* %23, i8** %21
ret i32 1
}

LLVM IR (-O2):
define i32 @cpy_bmp(i64 %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i8**
%4 = load i8*, i8** %3
%5 = lshr i64 %0, 8
%6 = trunc i64 %5 to i8
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %6, i8* %4
%8 = trunc i64 %0 to i8
store i8 %8, i8* %7
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 2
store i8* %10, i8** %3
ret i32 1
}
/* Variables and functions */
int string_match_len(char const *, int /*<<< orphan*/, char const *,
                     int /*<<< orphan*/, int);
int /*<<< orphan*/ strlen(char const *);
int string_match(const char *pattern, const char *string, int nocase) {
  return string_match_len(pattern, strlen(pattern), string, strlen(string),
                          nocase);
}


x86 assembly (clang, -O0):
<string_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
mov    -0x14(%rbp),%r8d
call   1040 <string_match_len@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_match>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <string_match_len@plt>

LLVM IR (-O0):
define i32 @string_match(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** %4
%9 = call i32 @strlen(i8* %8)
%10 = load i8*, i8** %5
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
%13 = load i32, i32* %6
%14 = call i32 @string_match_len(i8* %7, i32 %9, i8* %10, i32 %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @string_match(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @string_match_len(i8* %0, i32 %4, i8* %1, i32 %5, i32 %2)
ret i32 %6
}
/* Variables and functions */
int draw_block4x4_bptc_float_shared(unsigned char const *, unsigned int *, int,
                                    int);
int draw_block4x4_bptc_signed_float(const unsigned char *bitstring,
                                    unsigned int *image_buffer, int flags) {
  return draw_block4x4_bptc_float_shared(bitstring, image_buffer, 1, flags);
}


x86 assembly (clang, -O0):
<draw_block4x4_bptc_signed_float>:
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),%ecx
mov    $0x1,%edx
call   1030 <draw_block4x4_bptc_float_shared@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_block4x4_bptc_signed_float>:
mov    %edx,%ecx
mov    $0x1,%edx
jmp    1030 <draw_block4x4_bptc_float_shared@plt>

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

LLVM IR (-O2):
define i32 @draw_block4x4_bptc_signed_float(i8* %0, i32* %1, i32 %2) {
%4 = tail call i32 @draw_block4x4_bptc_float_shared(i8* %0, i32* %1, i32 1, i32 %2)
ret i32 %4
}