xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int socklen_t;
typedef int /*<<< orphan*/ optval;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_ERROR;
int getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int *);
int getSocketError(int socket) {
  int optval = 0;
  socklen_t optlen = sizeof(optval);
  int retVal = getsockopt(socket, SOL_SOCKET, SO_ERROR, &optval, &optlen);
  if (retVal < 0) {
    return retVal;
  }
  return optval;
}


x86 assembly (clang, -O0):
<getSocketError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
mov    0x2e9c(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <getsockopt@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1163 <getSocketError+0x53>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <getSocketError+0x59>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSocketError>:
push   %rax
movl   $0x0,(%rsp)
movl   $0x4,0x4(%rsp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
lea    0x4(%rsp),%r8
call   1030 <getsockopt@plt>
test   %eax,%eax
js     1146 <getSocketError+0x36>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
define i32 @getSocketError(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
store i32 4, i32* %5
%7 = load i32, i32* %3
%8 = load i32, i32* @SOL_SOCKET
%9 = load i32, i32* @SO_ERROR
%10 = call i32 @getsockopt(i32 %7, i32 %8, i32 %9, i32* %4, i32* %5)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = load i32, i32* %6
store i32 %14, i32* %2
br label %17
15: ; preds = %1
%16 = load i32, i32* %4
store i32 %16, i32* %2
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
define i32 @getSocketError(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_ERROR
%8 = call i32 @getsockopt(i32 %0, i32 %6, i32 %7, i32* %2, i32* %3)
%9 = icmp slt i32 %8, 0
%10 = load i32, i32* %2
%11 = select i1 %9, i32 %8, i32 %10
ret i32 %11
}
void RTC_Zero(void) {
  (*(volatile unsigned long *)(0xE0024000 + 0x08)) |= (1 << 1);
  (*(volatile unsigned long *)(0xE0024000 + 0x20)) =
      (*(volatile unsigned long *)(0xE0024000 + 0x24)) =
          (*(volatile unsigned long *)(0xE0024000 + 0x28)) = 0;
  (*(volatile unsigned long *)(0xE0024000 + 0x08)) &= ~(1 << 1);
}


x86 assembly (clang, -O0):
<RTC_Zero>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0024008,%eax
mov    (%rax),%rcx
or     $0x2,%rcx
mov    $0xe0024008,%eax
mov    %rcx,(%rax)
mov    $0xe0024028,%eax
movq   $0x0,(%rax)
mov    $0xe0024024,%eax
movq   $0x0,(%rax)
mov    $0xe0024020,%eax
movq   $0x0,(%rax)
mov    $0xe0024008,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffd,%rcx
mov    $0xe0024008,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTC_Zero>:
mov    $0xe0024008,%eax
orq    $0x2,(%rax)
movq   $0x0,0x20(%rax)
movq   $0x0,0x1c(%rax)
movq   $0x0,0x18(%rax)
andq   $0xfffffffffffffffd,(%rax)
ret

LLVM IR (-O0):
define void @RTC_Zero() {
%1 = load volatile i64, i64* inttoptr (i64 3758243848 to i64*)
%2 = or i64 %1, 2
store volatile i64 %2, i64* inttoptr (i64 3758243848 to i64*)
store volatile i64 0, i64* inttoptr (i64 3758243880 to i64*)
store volatile i64 0, i64* inttoptr (i64 3758243876 to i64*)
store volatile i64 0, i64* inttoptr (i64 3758243872 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 3758243848 to i64*)
%4 = and i64 %3, -3
store volatile i64 %4, i64* inttoptr (i64 3758243848 to i64*)
ret void
}

LLVM IR (-O2):
define void @RTC_Zero() {
%1 = load volatile i64, i64* inttoptr (i64 3758243848 to i64*)
%2 = or i64 %1, 2
store volatile i64 %2, i64* inttoptr (i64 3758243848 to i64*)
store volatile i64 0, i64* inttoptr (i64 3758243880 to i64*)
store volatile i64 0, i64* inttoptr (i64 3758243876 to i64*)
store volatile i64 0, i64* inttoptr (i64 3758243872 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 3758243848 to i64*)
%4 = and i64 %3, -3
store volatile i64 %4, i64* inttoptr (i64 3758243848 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main() {
  int unsigned value;
  do {
    printf("Enter a value greater than 20: ");
    scanf("%d", &value);
  } while (value > 20);
  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 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x14,-0x8(%rbp)
ja     112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%r14
lea    0xee9(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0x14,0xc(%rsp)
ja     1140 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Enter a value greater than 20: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %6, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp ugt i32 %7, 20
br i1 %8, label %3, label %9
9: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Enter a value greater than 20: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp ugt i32 %6, 20
br i1 %7, label %3, label %8
8: ; preds = %3
ret i32 0
}
void g_relation_delete() {}


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

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

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

LLVM IR (-O2):
define void @g_relation_delete() {
ret void
}
void intViewClean(struct LSD_SceneNodeInst const *inst, void *instData) {}


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

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

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

LLVM IR (-O2):
%struct.LSD_SceneNodeInst = type opaque
define void @intViewClean(%struct.LSD_SceneNodeInst* nocapture %0, i8* nocapture %1) {
ret void
}
void orr_0(int *a) {
  for (int i = 0; i < 1024; i++)
    a[i] |= 0xab;
}


x86 assembly (clang, -O0):
<orr_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    113e <orr_0+0x3e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
or     $0xab,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <orr_0+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<orr_0>:
xor    %eax,%eax
movaps 0xef7(%rip),%xmm0
nopl   0x0(%rax)
movups (%rdi,%rax,4),%xmm1
movups 0x10(%rdi,%rax,4),%xmm2
movups 0x20(%rdi,%rax,4),%xmm3
movups 0x30(%rdi,%rax,4),%xmm4
orps   %xmm0,%xmm1
orps   %xmm0,%xmm2
movups %xmm1,(%rdi,%rax,4)
movups %xmm2,0x10(%rdi,%rax,4)
orps   %xmm0,%xmm3
orps   %xmm0,%xmm4
movups %xmm3,0x20(%rdi,%rax,4)
movups %xmm4,0x30(%rdi,%rax,4)
add    $0x10,%rax
cmp    $0x400,%rax
jne    1110 <orr_0+0x10>
ret

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

LLVM IR (-O2):
define void @orr_0(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %25, %2 ]
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = bitcast i32* %4 to <4 x i32>*
%6 = load <4 x i32>, <4 x i32>* %5
%7 = getelementptr inbounds i32, i32* %4, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
%9 = load <4 x i32>, <4 x i32>* %8
%10 = or <4 x i32> %6, <i32 171, i32 171, i32 171, i32 171>
%11 = or <4 x i32> %9, <i32 171, i32 171, i32 171, i32 171>
%12 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> %10, <4 x i32>* %12
%13 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> %11, <4 x i32>* %13
%14 = or i64 %3, 8
%15 = getelementptr inbounds i32, i32* %0, i64 %14
%16 = bitcast i32* %15 to <4 x i32>*
%17 = load <4 x i32>, <4 x i32>* %16
%18 = getelementptr inbounds i32, i32* %15, i64 4
%19 = bitcast i32* %18 to <4 x i32>*
%20 = load <4 x i32>, <4 x i32>* %19
%21 = or <4 x i32> %17, <i32 171, i32 171, i32 171, i32 171>
%22 = or <4 x i32> %20, <i32 171, i32 171, i32 171, i32 171>
%23 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> %21, <4 x i32>* %23
%24 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %24
%25 = add nuw nsw i64 %3, 16
%26 = icmp eq i64 %25, 1024
br i1 %26, label %27, label %2
27: ; preds = %2
ret void
}
int test_imm_0Euint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x0E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_0Euint64_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, 14
%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_0Euint64_midword_reg(i64 %0) {
%2 = and i64 %0, 917504
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
const char *hstrerror(herr)
int herr;
{
  {
    static char buf[100];
    sprintf(buf, "Host lookup error %d", herr);
    return buf;
  }
}


x86 assembly (clang, -O0):
<hstrerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0x2f1b(%rip),%rdi
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2f06(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hstrerror>:
push   %rbx
mov    %edi,%edx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@hstrerror.buf = internal global [100 x i8] zeroinitializer
@.str = [21 x i8] c"Host lookup error %d\00"
define i8* @hstrerror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @hstrerror.buf, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @hstrerror.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@hstrerror.buf = internal global [100 x i8] zeroinitializer
@.str = [21 x i8] c"Host lookup error %d\00"
define i8* @hstrerror(i32 %0) {
%2 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @hstrerror.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @hstrerror.buf, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ TWI_Start_Transceiver_With_Data(unsigned char *, int);
void TWI_Write(unsigned char reg, unsigned char data) {
  unsigned char messageBuf[8] = {0};
  messageBuf[0] = (0x68 << 1);
  messageBuf[1] = reg;
  messageBuf[2] = data;
  TWI_Start_Transceiver_With_Data(messageBuf, 3);
  return;
}


x86 assembly (clang, -O0):
<TWI_Write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
lea    -0xa(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
movb   $0xd0,-0xa(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x2(%rbp),%al
mov    %al,-0x8(%rbp)
lea    -0xa(%rbp),%rdi
mov    $0x3,%esi
call   1040 <TWI_Start_Transceiver_With_Data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TWI_Write>:
push   %rax
movq   $0xd0,(%rsp)
mov    %dil,0x1(%rsp)
mov    %sil,0x2(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1030 <TWI_Start_Transceiver_With_Data@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @TWI_Write(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca [8 x i8]
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = bitcast [8 x i8]* %5 to i8*
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
store i8 -48, i8* %7
%8 = load i8, i8* %3
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 1
store i8 %8, i8* %9
%10 = load i8, i8* %4
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 2
store i8 %10, i8* %11
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%13 = call i32 @TWI_Start_Transceiver_With_Data(i8* %12, i32 3)
ret void
}

LLVM IR (-O2):
define void @TWI_Write(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to [8 x i8]*
%5 = bitcast i64* %3 to i8*
store i64 208, i64* %3
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 1
store i8 %0, i8* %6
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 2
store i8 %1, i8* %7
%8 = call i32 @TWI_Start_Transceiver_With_Data(i8* %5, i32 3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ pthread_self();
void print_it(void *arg) {
  int *try = (int *)arg;
  pthread_t tid;
  tid = pthread_self();
  printf("Thread %lx was canceled on its %d try.\n", tid, *try);
}


x86 assembly (clang, -O0):
<print_it>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_it>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    (%rbx),%edx
lea    0xecc(%rip),%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Thread %lx was canceled on its %d try.\0A\00"
define void @print_it(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
%7 = call i32 (...) @pthread_self()
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Thread %lx was canceled on its %d try.\0A\00"
define void @print_it(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 (...) @pthread_self()
%4 = load i32, i32* %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int ENOSYS;
int xntrace_max_end(unsigned long v) { return -ENOSYS; }


x86 assembly (clang, -O0):
<xntrace_max_end>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ed7(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xntrace_max_end>:
mov    0x2ee1(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @xntrace_max_end(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i32, i32* @ENOSYS
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @xntrace_max_end(i64 %0) {
%2 = load i32, i32* @ENOSYS
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
char *mystrnrchr(char const *, int, size_t);
char *mystrnrchr_chk(const char *in, int ch, size_t end) {
  if (!end)
    return 0;
  return mystrnrchr(in, ch, end);
}


x86 assembly (clang, -O0):
<mystrnrchr_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    113b <mystrnrchr_chk+0x2b>
movq   $0x0,-0x8(%rbp)
jmp    114f <mystrnrchr_chk+0x3f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <mystrnrchr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrnrchr_chk>:
test   %rdx,%rdx
je     111a <mystrnrchr_chk+0xa>
jmp    1030 <mystrnrchr@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @mystrnrchr_chk(i8* %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i8* @mystrnrchr(i8* %0, i32 %1, i64 %2)
br label %7
7: ; preds = %3, %5
%8 = phi i8* [ %6, %5 ], [ null, %3 ]
ret i8* %8
}
/* Variables and functions */
unsigned int i2c_get_bus_num();
unsigned int I2C_GET_BUS(void) { return 0 ? i2c_get_bus_num() : 0; }


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

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

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

LLVM IR (-O2):
define i32 @I2C_GET_BUS() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_cmpgt_epi8(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_setzero_si128();
int /*<<< orphan*/ _mm_unpacklo_epi8(int /*<<< orphan*/, int /*<<< orphan*/);
extern __attribute__((__gnu___, __always___, __artificial__)) __m128i
_MM_CVTEPI8_EPI16(__m128i a) {
  __m128i zero = _mm_setzero_si128();
  __m128i sign = _mm_cmpgt_epi8(zero, a);
  return _mm_unpacklo_epi8(a, sign);
}


x86 assembly (clang, -O0):
<_MM_CVTEPI8_EPI16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <_mm_setzero_si128@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1050 <_mm_cmpgt_epi8@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <_mm_unpacklo_epi8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_MM_CVTEPI8_EPI16>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <_mm_setzero_si128@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1050 <_mm_cmpgt_epi8@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <_mm_unpacklo_epi8@plt>

LLVM IR (-O0):
define i32 @_MM_CVTEPI8_EPI16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 (...) @_mm_setzero_si128()
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = call i32 @_mm_cmpgt_epi8(i32 %6, i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = call i32 @_mm_unpacklo_epi8(i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @_MM_CVTEPI8_EPI16(i32 %0) {
%2 = tail call i32 (...) @_mm_setzero_si128()
%3 = tail call i32 @_mm_cmpgt_epi8(i32 %2, i32 %0)
%4 = tail call i32 @_mm_unpacklo_epi8(i32 %0, i32 %3)
ret i32 %4
}
void vector_scale3(double a[3], double s, double m[3]) {
  for (int i = 0; i < 3; ++i) {
    m[i] = a[i] * s;
  }
}


x86 assembly (clang, -O0):
<vector_scale3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    114f <vector_scale3+0x4f>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1118 <vector_scale3+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_scale3>:
movsd  (%rdi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
movsd  0x8(%rdi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsi)
mulsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x10(%rsi)
ret

LLVM IR (-O0):
define void @vector_scale3(double* %0, double %1, double* %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double*
%7 = alloca i32
store double* %0, double** %4
store double %1, double* %5
store double* %2, double** %6
store i32 0, i32* %7
br label %8
8: ; preds = %23, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load double*, double** %4
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = load double, double* %5
%18 = fmul double %16, %17
%19 = load double*, double** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
store double %18, double* %22
br label %23
23: ; preds = %11
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %8
26: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @vector_scale3(double* nocapture %0, double %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = fmul double %4, %1
store double %5, double* %2
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = fmul double %7, %1
%9 = getelementptr inbounds double, double* %2, i64 1
store double %8, double* %9
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = load double, double* %10
%12 = fmul double %11, %1
%13 = getelementptr inbounds double, double* %2, i64 2
store double %12, double* %13
ret void
}
int isPositive(int x) {
  int msb = !(x >> 31);
  return msb & !!x;
}


x86 assembly (clang, -O0):
<isPositive>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmpl   $0x0,-0x4(%rbp)
setne  %cl
xor    $0xff,%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPositive>:
mov    %edi,%ecx
not    %ecx
shr    $0x1f,%ecx
xor    %eax,%eax
test   %edi,%edi
setne  %al
and    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @isPositive(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 31
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = and i32 %9, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @isPositive(i32 %0) {
%2 = xor i32 %0, -1
%3 = lshr i32 %2, 31
%4 = icmp ne i32 %0, 0
%5 = zext i1 %4 to i32
%6 = and i32 %3, %5
ret i32 %6
}
/* Variables and functions */
scalar_t__ isalnum(char const);
const char *skip_alnums(const char *buffer) {
  const char *ret = buffer;
  while (*ret != '\0' && isalnum(*ret))
    ++ret;
  return ret;
}


x86 assembly (clang, -O0):
<skip_alnums>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     114f <skip_alnums+0x3f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115f <skip_alnums+0x4f>
jmp    1170 <skip_alnums+0x60>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <skip_alnums+0x14>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_alnums>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1139 <skip_alnums+0x29>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isalnum@plt>
test   %rax,%rax
je     1139 <skip_alnums+0x29>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <skip_alnums+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skip_alnums(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i64 @isalnum(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %1
%14 = phi i8* [ %0, %1 ], [ %10, %9 ], [ %6, %4 ]
ret i8* %14
}
/* Variables and functions */
unsigned long next_collatz_sequence(unsigned long);
int collatz_sequence(unsigned long n) {
  int num_sequence = 1;
  while (n > 1) {
    ++num_sequence;
    n = next_collatz_sequence(n);
  }
  return num_sequence;
}


x86 assembly (clang, -O0):
<collatz_sequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpq   $0x1,-0x8(%rbp)
jbe    1149 <collatz_sequence+0x39>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <next_collatz_sequence@plt>
mov    %rax,-0x8(%rbp)
jmp    1123 <collatz_sequence+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collatz_sequence>:
push   %rbx
mov    $0x1,%ebx
cmp    $0x2,%rdi
jb     1141 <collatz_sequence+0x31>
mov    %rdi,%rax
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebx
mov    %rax,%rdi
call   1030 <next_collatz_sequence@plt>
cmp    $0x1,%rax
ja     1130 <collatz_sequence+0x20>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @collatz_sequence(i64 %0) {
%2 = icmp ugt i64 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 1, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = tail call i64 @next_collatz_sequence(i64 %5)
%8 = icmp ugt i64 %7, 1
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_CIPHER;

/* Variables and functions */
int /*<<< orphan*/ const *EVP_aes_256_cfb128();
const EVP_CIPHER *EVP_aes_256_cfb(void) { return EVP_aes_256_cfb128(); }


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

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

LLVM IR (-O0):
define i32* @EVP_aes_256_cfb() {
%1 = call i32* (...) @EVP_aes_256_cfb128()
ret i32* %1
}

LLVM IR (-O2):
define i32* @EVP_aes_256_cfb() {
%1 = tail call i32* (...) @EVP_aes_256_cfb128()
ret i32* %1
}
/* Type definitions */
typedef int clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
int clock();
unsigned FIO_GetMilliSpan(clock_t nPrevious) {
  clock_t nCurrent = clock();
  unsigned nSpan = (unsigned)(((nCurrent - nPrevious) * 1000) / CLOCKS_PER_SEC);
  return nSpan;
}


x86 assembly (clang, -O0):
<FIO_GetMilliSpan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
imul   $0x3e8,%eax,%eax
mov    0x2eb0(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FIO_GetMilliSpan>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <clock@plt>
sub    %ebx,%eax
imul   $0x3e8,%eax,%eax
mov    0x2ebf(%rip),%rcx
cltd
idivl  (%rcx)
pop    %rbx
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i32 0
define i32 @FIO_GetMilliSpan(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 (...) @clock()
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = sub nsw i32 %6, %7
%9 = mul nsw i32 %8, 1000
%10 = load i32, i32* @CLOCKS_PER_SEC
%11 = sdiv i32 %9, %10
store i32 %11, i32* %4
%12 = load i32, i32* %4
ret i32 %12
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
define i32 @FIO_GetMilliSpan(i32 %0) {
%2 = tail call i32 (...) @clock()
%3 = sub nsw i32 %2, %0
%4 = mul nsw i32 %3, 1000
%5 = load i32, i32* @CLOCKS_PER_SEC
%6 = sdiv i32 %4, %5
ret i32 %6
}
int mr_mypartition(int reduce_tasks, void *key, int key_size) {
  unsigned int max_int = 0x40000;
  unsigned int val = *(unsigned int *)key;
  unsigned int part_size = max_int / reduce_tasks;
  return (val / part_size);
}


x86 assembly (clang, -O0):
<mr_mypartition>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x40000,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
xor    %edx,%edx
divl   -0x4(%rbp)
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
xor    %edx,%edx
divl   -0x20(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mr_mypartition>:
mov    (%rsi),%ecx
mov    $0x40000,%eax
xor    %edx,%edx
div    %edi
mov    %eax,%esi
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
define i32 @mr_mypartition(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 262144, i32* %7
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
store i32 %12, i32* %8
%13 = load i32, i32* %7
%14 = load i32, i32* %4
%15 = udiv i32 %13, %14
store i32 %15, i32* %9
%16 = load i32, i32* %8
%17 = load i32, i32* %9
%18 = udiv i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @mr_mypartition(i32 %0, i8* nocapture %1, i32 %2) {
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %4
%6 = udiv i32 262144, %0
%7 = udiv i32 %5, %6
ret i32 %7
}
/* Type definitions */
struct avifIO {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ avifFree(struct avifIO *);
void avifIOStreamingReaderDestroy(struct avifIO *io) { avifFree(io); }


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

x86 assembly (clang, -O2):
<avifIOStreamingReaderDestroy>:
jmp    1030 <avifFree@plt>

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

LLVM IR (-O2):
%struct.avifIO = type { i32 }
define void @avifIOStreamingReaderDestroy(%struct.avifIO* %0) {
%2 = tail call i32 @avifFree(%struct.avifIO* %0)
ret void
}
int resizeterm(int lines, int columns) {
  (void)lines;
  (void)columns;
  return (0);
}


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

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

LLVM IR (-O0):
define i32 @resizeterm(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
ret i32 0
}

LLVM IR (-O2):
define i32 @resizeterm(i32 %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ int_least32_t;

/* Variables and functions */
bool SHAREMIND_SET_KEY_EQUALS_int_least32_t(int_least32_t const k1,
                                            int_least32_t const k2) {
  return k1 == k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_SET_KEY_EQUALS_int_least32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_SET_KEY_EQUALS_int_least32_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @SHAREMIND_SET_KEY_EQUALS_int_least32_t(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
unsigned int G(unsigned int x, unsigned int y, unsigned int z) {
  return (x & y) | (x & z) | (y & z);
}


x86 assembly (clang, -O0):
<G>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<G>:
mov    %edx,%eax
or     %esi,%eax
and    %edi,%eax
and    %esi,%edx
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @G(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = and i32 %7, %8
%10 = load i32, i32* %4
%11 = load i32, i32* %6
%12 = and i32 %10, %11
%13 = or i32 %9, %12
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = and i32 %14, %15
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @G(i32 %0, i32 %1, i32 %2) {
%4 = or i32 %2, %1
%5 = and i32 %4, %0
%6 = and i32 %2, %1
%7 = or i32 %5, %6
ret i32 %7
}
/* Variables and functions */
char *_(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int error_errno(const char *str) {
  fprintf(stderr, _("Error (%s): %s\n"), str, strerror(errno));
  return -1;
}


x86 assembly (clang, -O0):
<error_errno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
lea    0xeb1(%rip),%rdi
call   1040 <_@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_errno>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    0x2ea2(%rip),%rax
mov    (%rax),%ebp
lea    0xeb9(%rip),%rdi
call   1040 <_@plt>
mov    %rax,%rbx
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Error (%s): %s\0A\00"
@errno = global i32 0
define i32 @error_errno(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i8* @_(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @errno
%5 = tail call i8* @strerror(i32 %4)
%6 = tail call i32 @fprintf(i32 %2, i8* %3, i8* %0, i8* %5)
ret i32 -1
}
void class2slashcharclass() {}


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

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

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

LLVM IR (-O2):
define void @class2slashcharclass() {
ret void
}
/* Variables and functions */
int add(int, int);
int getpid();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ test();
void main() {
  printf("pid = %d\n", getpid());
  printf("1 + 2 = %d\n", add(1, 2));
  test();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <add@plt>
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <test@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"pid = %d\0A\00"
@.str.1 = [12 x i8] c"1 + 2 = %d\0A\00"
define void @main() {
%1 = call i32 (...) @getpid()
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @add(i32 1, i32 2)
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @test()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"pid = %d\0A\00"
@.str.1 = [12 x i8] c"1 + 2 = %d\0A\00"
define void @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @add(i32 1, i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void ShowData(unsigned int value) {
  unsigned int i;
  for (i = 0; i < 32; i++)
    printf("%d", (value >> (31 - i)) & 1);
  printf(" (%08X)\n", value);
}


x86 assembly (clang, -O0):
<ShowData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jae    1156 <ShowData+0x46>
mov    -0x4(%rbp),%esi
mov    $0x1f,%ecx
sub    -0x8(%rbp),%ecx
shr    %cl,%esi
and    $0x1,%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <ShowData+0x12>
mov    -0x4(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShowData>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x1f,%ebp
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%esi
mov    %ebp,%ecx
shr    %cl,%esi
and    $0x1,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jb     1130 <ShowData+0x20>
lea    0xeb6(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c" (%08X)\0A\00"
define void @ShowData(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 32
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = sub i32 31, %9
%11 = lshr i32 %8, %10
%12 = and i32 %11, 1
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
%18 = load i32, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %18)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c" (%08X)\0A\00"
define void @ShowData(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %8, %2 ]
%4 = sub nuw nsw i32 31, %3
%5 = lshr i32 %0, %4
%6 = and i32 %5, 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = add nuw nsw i32 %3, 1
%9 = icmp eq i32 %8, 32
br i1 %9, label %10, label %2
10: ; preds = %2
%11 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
char *mhs_stpcpy(char *dest, const char *src) {
  register char *d = dest;
  register const char *s = src;
  do
    *d++ = *s;
  while (*s++);
  return (d - 1);
}


x86 assembly (clang, -O0):
<mhs_stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
cmpb   $0x0,(%rax)
jne    111c <mhs_stpcpy+0x1c>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mhs_stpcpy>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl (%rsi),%ecx
mov    %cl,0x1(%rax)
add    $0x1,%rax
cmpb   $0x0,(%rsi)
lea    0x1(%rsi),%rsi
jne    1110 <mhs_stpcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @mhs_stpcpy(i8* writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = phi i8* [ %1, %2 ], [ %8, %3 ]
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %6, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %5
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *emalloc(size_t size, char *errmsg) {
  void *val = malloc(size);
  if (val == NULL) {
    fprintf(stderr, "\n%s\n", errmsg);
    exit(12);
  }
  return val;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117b <emalloc+0x4b>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xc,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %rbx
mov    %rsi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1140 <emalloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0xc,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [5 x i8] c"\0A%s\0A\00"
define i8* @emalloc(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = load i64, i64* %3
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %4
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 12)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"\0A%s\0A\00"
define noalias i8* @emalloc(i64 %0, i8* %1) {
%3 = tail call i8* @malloc(i64 %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
%8 = tail call i32 @exit(i32 12)
unreachable
9: ; preds = %2
ret i8* %3
}