xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int isABS(const char *tok) { return strcmp(tok, "abs") == 0; }


x86 assembly (clang, -O0):
<isABS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isABS>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abs\00"
define i32 @isABS(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [4 x i8] c"abs\00"
define i32 @isABS(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
__int128 quad_exchange(__int128 *ptr, __int128 newval) {
  return __atomic_exchange_n(ptr, newval, 0);
}


x86 assembly (clang, -O0):
<quad_exchange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdi,-0x28(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x48(%rbp)
mov    %rax,-0x50(%rbp)
mov    $0x10,%edi
lea    -0x50(%rbp),%rdx
lea    -0x60(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <__atomic_exchange@plt>
mov    -0x60(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quad_exchange>:
sub    $0x28,%rsp
mov    %rdi,%rax
mov    %rdx,0x18(%rsp)
mov    %rsi,0x10(%rsp)
lea    0x10(%rsp),%rdx
mov    %rsp,%rcx
mov    $0x10,%edi
mov    %rax,%rsi
xor    %r8d,%r8d
call   1030 <__atomic_exchange@plt>
mov    (%rsp),%rax
mov    0x8(%rsp),%rdx
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define { i64, i64 } @quad_exchange(i128* %0, i64 %1, i64 %2) {
%4 = alloca i128
%5 = alloca i128
%6 = zext i64 %2 to i128
%7 = shl nuw i128 %6, 64
%8 = zext i64 %1 to i128
%9 = or i128 %7, %8
store i128 %9, i128* %4
%10 = bitcast i128* %0 to i8*
%11 = bitcast i128* %4 to i8*
%12 = bitcast i128* %5 to i8*
%13 = load i128, i128* %5
%14 = trunc i128 %13 to i64
%15 = lshr i128 %13, 64
%16 = trunc i128 %15 to i64
%17 = insertvalue { i64, i64 } poison, i64 %14, 0
%18 = insertvalue { i64, i64 } %17, i64 %16, 1
ret { i64, i64 } %18
}
/* Variables and functions */
scalar_t__ eventfd(int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  if (eventfd(0, 0) < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1030 <eventfd@plt>
cmp    $0x0,%rax
jge    113e <main+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1145 <main+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <eventfd@plt>
sar    $0x3f,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @eventfd(i32 0, i32 0)
%2 = ashr i64 %1, 63
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef scalar_t__ ui32Base;

/* Variables and functions */
void PWMDeadBandDisable(uint32_t ui32Base, uint32_t ui32Gen) {
  ;
  ;
  (*((volatile unsigned long *)(((ui32Base) + (ui32Gen)) + 0x00000028))) &=
      ~(0x00000001);
}


x86 assembly (clang, -O0):
<PWMDeadBandDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    0x28(%rax),%rcx
and    $0xfffffffffffffffe,%rcx
mov    %rcx,0x28(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMDeadBandDisable>:
andq   $0xfffffffffffffffe,0x28(%rdi,%rsi,1)
ret

LLVM IR (-O0):
define void @PWMDeadBandDisable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add nsw i64 %5, %6
%8 = add nsw i64 %7, 40
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = and i64 %10, -2
store volatile i64 %11, i64* %9
ret void
}

LLVM IR (-O2):
define void @PWMDeadBandDisable(i64 %0, i64 %1) {
%3 = add i64 %0, 40
%4 = add i64 %3, %1
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, -2
store volatile i64 %7, i64* %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
int /*<<< orphan*/ _mm_unpackhi_pi32(int /*<<< orphan*/, int /*<<< orphan*/);
__m64 test_mm_unpackhi_pi32(__m64 a, __m64 b) {
  return _mm_unpackhi_pi32(a, b);
}


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

x86 assembly (clang, -O2):
<test_mm_unpackhi_pi32>:
jmp    1030 <_mm_unpackhi_pi32@plt>

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

LLVM IR (-O2):
define i32 @test_mm_unpackhi_pi32(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_unpackhi_pi32(i32 %0, i32 %1)
ret i32 %3
}
int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure) {
  return 0;
}


x86 assembly (clang, -O0):
<xf86InstallSIGIOHandler>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xf86InstallSIGIOHandler(i32 %0, void (i32, i8*)* %1, i8* %2) {
%4 = alloca i32
%5 = alloca void (i32, i8*)*
%6 = alloca i8*
store i32 %0, i32* %4
store void (i32, i8*)* %1, void (i32, i8*)** %5
store i8* %2, i8** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @xf86InstallSIGIOHandler(i32 %0, void (i32, i8*)* nocapture readnone %1, i8* nocapture readnone %2) {
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int count;
};
struct TYPE_4__ {
  TYPE_1__ xexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xexpose_count(void *_p, int _v) {
  ((XEvent *)_p)->xexpose.count = (int)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xexpose_count(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xexpose_count(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
char *malloc(n)
int n;
{ return bZa(n); }


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

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

LLVM IR (-O0):
define i8* @malloc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @bZa to i32 (i32, ...)*)(i32 %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @malloc(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @bZa to i32 (i32, ...)*)(i32 %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
int priority_to_int(const char pri) {
  switch (pri) {
  case 'H':
    return 3;
    break;
  case 'M':
    return 2;
    break;
  case 'L':
    return 1;
    break;
  default:
  case 0:
    return 0;
    break;
  }
}


x86 assembly (clang, -O0):
<priority_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     117a <priority_to_int+0x7a>
jmp    111e <priority_to_int+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x48,%eax
je     1151 <priority_to_int+0x51>
jmp    112f <priority_to_int+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x4c,%eax
je     1169 <priority_to_int+0x69>
jmp    1140 <priority_to_int+0x40>
mov    -0xc(%rbp),%eax
sub    $0x4d,%eax
je     115d <priority_to_int+0x5d>
jmp    1175 <priority_to_int+0x75>
movl   $0x3,-0x4(%rbp)
jmp    1181 <priority_to_int+0x81>
movl   $0x2,-0x4(%rbp)
jmp    1181 <priority_to_int+0x81>
movl   $0x1,-0x4(%rbp)
jmp    1181 <priority_to_int+0x81>
jmp    117a <priority_to_int+0x7a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<priority_to_int>:
add    $0xffffffb8,%edi
xor    %eax,%eax
cmp    $0x5,%edi
ja     1117 <priority_to_int+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @priority_to_int(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %9 [
i32 72, label %6
i32 77, label %7
i32 76, label %8
i32 0, label %10
]
6: ; preds = %1
store i32 3, i32* %2
br label %11
7: ; preds = %1
store i32 2, i32* %2
br label %11
8: ; preds = %1
store i32 1, i32* %2
br label %11
9: ; preds = %1
br label %10
10: ; preds = %1, %9
store i32 0, i32* %2
br label %11
11: ; preds = %10, %8, %7, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@switch.table.priority_to_int = [6 x i32] [i32 3, i32 0, i32 0, i32 0, i32 1, i32 2]
define i32 @priority_to_int(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -72
%4 = icmp ult i32 %3, 6
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.priority_to_int, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 0, %1 ]
ret i32 %10
}
/* Type definitions */
struct mmsghdr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __sendmmsg(int fd, struct mmsghdr *vmessages, unsigned int vlen,
               int flags) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__sendmmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sendmmsg>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.mmsghdr = type { i32 }
@ENOSYS = global i32 0
define i32 @__sendmmsg(i32 %0, %struct.mmsghdr* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.mmsghdr*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store %struct.mmsghdr* %1, %struct.mmsghdr** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* @ENOSYS
%10 = call i32 @__set_errno(i32 %9)
ret i32 -1
}

LLVM IR (-O2):
%struct.mmsghdr = type { i32 }
@ENOSYS = global i32 0
define i32 @__sendmmsg(i32 %0, %struct.mmsghdr* nocapture readnone %1, i32 %2, i32 %3) {
%5 = load i32, i32* @ENOSYS
%6 = tail call i32 @__set_errno(i32 %5)
ret i32 -1
}
/* Type definitions */
struct DynamicBuffer {
  int dummy;
};

/* Variables and functions */
char DynamicBufferFGetChar(struct DynamicBuffer *, int /*<<< orphan*/);
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ stdin;
char DynamicBufferGetChar(struct DynamicBuffer *self) {
  if (!self) {
    errno = EINVAL;
    return '\0';
  }
  return DynamicBufferFGetChar(self, stdin);
}


x86 assembly (clang, -O0):
<DynamicBufferGetChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1142 <DynamicBufferGetChar+0x32>
mov    0x2ea2(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea1(%rip),%rax
mov    %ecx,(%rax)
movb   $0x0,-0x1(%rbp)
jmp    1157 <DynamicBufferGetChar+0x47>
mov    -0x10(%rbp),%rdi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
call   1030 <DynamicBufferFGetChar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DynamicBufferGetChar>:
test   %rdi,%rdi
je     1123 <DynamicBufferGetChar+0x13>
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
jmp    1030 <DynamicBufferFGetChar@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
mov    0x2ea5(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.DynamicBuffer = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
@stdin = global i32 0
define signext i8 @DynamicBufferGetChar(%struct.DynamicBuffer* %0) {
%2 = alloca i8
%3 = alloca %struct.DynamicBuffer*
store %struct.DynamicBuffer* %0, %struct.DynamicBuffer** %3
%4 = load %struct.DynamicBuffer*, %struct.DynamicBuffer** %3
%5 = icmp ne %struct.DynamicBuffer* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = load i32, i32* @EINVAL
store i32 %7, i32* @errno
store i8 0, i8* %2
br label %12
8: ; preds = %1
%9 = load %struct.DynamicBuffer*, %struct.DynamicBuffer** %3
%10 = load i32, i32* @stdin
%11 = call signext i8 @DynamicBufferFGetChar(%struct.DynamicBuffer* %9, i32 %10)
store i8 %11, i8* %2
br label %12
12: ; preds = %8, %6
%13 = load i8, i8* %2
ret i8 %13
}

LLVM IR (-O2):
%struct.DynamicBuffer = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
@stdin = global i32 0
define signext i8 @DynamicBufferGetChar(%struct.DynamicBuffer* %0) {
%2 = icmp eq %struct.DynamicBuffer* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i32, i32* @EINVAL
store i32 %4, i32* @errno
br label %8
5: ; preds = %1
%6 = load i32, i32* @stdin
%7 = tail call signext i8 @DynamicBufferFGetChar(%struct.DynamicBuffer* %0, i32 %6)
br label %8
8: ; preds = %5, %3
%9 = phi i8 [ %7, %5 ], [ 0, %3 ]
ret i8 %9
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void main() {
  int x, y;
  assert(x != y);
}


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

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = icmp ne i32 %3, %4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @assert(i32 0)
ret void
}
int is_cap(char value) { return value >= 'A' && value <= 'Z'; }


x86 assembly (clang, -O0):
<is_cap>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <is_cap+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_cap>:
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_cap(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_cap(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t quicly_decode32(const uint8_t **src) {
  uint32_t v = (uint32_t)(*src)[0] << 24 | (uint32_t)(*src)[1] << 16 |
               (uint32_t)(*src)[2] << 8 | (*src)[3];
  *src += 4;
  return v;
}


x86 assembly (clang, -O0):
<quicly_decode32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
mov    0x4(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
mov    0x8(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
or     0xc(%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x10,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicly_decode32>:
mov    (%rdi),%rcx
mov    (%rcx),%eax
mov    0x4(%rcx),%edx
shl    $0x18,%eax
shl    $0x10,%edx
or     %eax,%edx
mov    0x8(%rcx),%eax
shl    $0x8,%eax
or     %edx,%eax
or     0xc(%rcx),%eax
add    $0x10,%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i32 @quicly_decode32(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
store i32** %0, i32*** %2
%4 = load i32**, i32*** %2
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = shl i32 %7, 24
%9 = load i32**, i32*** %2
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = shl i32 %12, 16
%14 = or i32 %8, %13
%15 = load i32**, i32*** %2
%16 = load i32*, i32** %15
%17 = getelementptr inbounds i32, i32* %16, i64 2
%18 = load i32, i32* %17
%19 = shl i32 %18, 8
%20 = or i32 %14, %19
%21 = load i32**, i32*** %2
%22 = load i32*, i32** %21
%23 = getelementptr inbounds i32, i32* %22, i64 3
%24 = load i32, i32* %23
%25 = or i32 %20, %24
store i32 %25, i32* %3
%26 = load i32**, i32*** %2
%27 = load i32*, i32** %26
%28 = getelementptr inbounds i32, i32* %27, i64 4
store i32* %28, i32** %26
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @quicly_decode32(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = load i32, i32* %2
%4 = shl i32 %3, 24
%5 = getelementptr inbounds i32, i32* %2, i64 1
%6 = load i32, i32* %5
%7 = shl i32 %6, 16
%8 = or i32 %7, %4
%9 = getelementptr inbounds i32, i32* %2, i64 2
%10 = load i32, i32* %9
%11 = shl i32 %10, 8
%12 = or i32 %8, %11
%13 = getelementptr inbounds i32, i32* %2, i64 3
%14 = load i32, i32* %13
%15 = or i32 %12, %14
%16 = getelementptr inbounds i32, i32* %2, i64 4
store i32* %16, i32** %0
ret i32 %15
}
void gtk_selection_data_free() {}


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

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

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

LLVM IR (-O2):
define void @gtk_selection_data_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int num1, num2, *p, *q, sum;
  printf("Enter two integers to add\n");
  scanf("%d%d", &num1, &num2);
  p = &num1;
  q = &num2;
  sum = *p + *q;
  printf("Sum of entered numbers = %d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
add    (%rcx),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    (%rsp),%esi
add    0x4(%rsp),%esi
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter two integers to add\0A\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [29 x i8] c"Sum of entered numbers = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
store i32* %2, i32** %4
store i32* %3, i32** %5
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = add nsw i32 %10, %12
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [29 x i8] c"Sum of entered numbers = %d\0A\00"
@str = [26 x i8] c"Enter two integers to add\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, %7
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void textcolor(char *color) { fprintf(stdout, "%s", color); }


x86 assembly (clang, -O0):
<textcolor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<textcolor>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define void @textcolor(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
double OP_Div(double op1, double op2) { return op1 / op2; }


x86 assembly (clang, -O0):
<OP_Div>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP_Div>:
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @OP_Div(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @OP_Div(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
void gdk_display_pointer_ungrab() {}


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

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

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

LLVM IR (-O2):
define void @gdk_display_pointer_ungrab() {
ret void
}
/* Variables and functions */
int __syscall0(int);
int _syscall0(int nr) { return __syscall0(nr); }


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

x86 assembly (clang, -O2):
<_syscall0>:
jmp    1030 <__syscall0@plt>

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

LLVM IR (-O2):
define i32 @_syscall0(i32 %0) {
%2 = tail call i32 @__syscall0(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ uart_puts(char *);
void protocol_onbooted(void) { uart_puts("BOOTED"); }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"BOOTED\00"
define void @protocol_onbooted() {
%1 = tail call i32 @uart_puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void my_func(int signum) {
  printf("If you want to quit, please try SIGQUIT\n");
}


x86 assembly (clang, -O0):
<my_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [41 x i8] c"If you want to quit, please try SIGQUIT\0A\00"
define void @my_func(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [40 x i8] c"If you want to quit, please try SIGQUIT\00"
define void @my_func(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned long int cast_short_ulong(short int x) { return (unsigned long int)x; }


x86 assembly (clang, -O0):
<cast_short_ulong>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswq -0x2(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cast_short_ulong>:
movslq %edi,%rax
ret

LLVM IR (-O0):
define i64 @cast_short_ulong(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @cast_short_ulong(i16 signext %0) {
%2 = sext i16 %0 to i64
ret i64 %2
}
void fd105(int n) {
P0A:
  goto P0A;
  {
    typedef int(*b)[n];
  P01A:
    goto P01A;
    {
      typedef int(*c)[n];
    P012A:
      goto P012A;
      0;
    }
  a : {
    typedef int(*d)[n];
  P013A:
    goto P013A;
    0;
  }
  P01C:
    goto P01C;
    ;
    typedef int(*e)[n];
  p014A:
    goto p014A;
    goto a;
  P014A:
    goto P014A;
    0;
  };
P0B:
  goto P0B;
  {
    typedef int(*f)[n];
  P02A:
    goto P02A;
    {
      typedef int(*g)[n];
    P024A:
      goto P024A;
      0;
    };
  P02B:
    goto P02B;
    {
      typedef int(*h)[n];
    P025A:
      goto P025A;
      0;
    };
  P02C:
    goto P02C;
    ;
    typedef int(*i)[n];
  P026A:
    goto P026A;
    0;
  };
P0C:
  goto P0C;
  ;
  typedef int(*j)[n];
P03A:
  goto P03A;
  0;
P03B:
  goto P03B;
}


x86 assembly (clang, -O0):
<fd105>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fd105+0x7>

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

LLVM IR (-O0):
define void @fd105(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %3, %1
br label %3
4: ; No predecessors!
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %7, %4
br label %7
8: ; No predecessors!
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %11, %8
br label %11
12: ; No predecessors!
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
br label %15
15: ; preds = %15, %12
br label %15
16: ; preds = %16
br label %16
17: ; No predecessors!
%18 = load i32, i32* %2
%19 = zext i32 %18 to i64
br label %20
20: ; preds = %20, %17
br label %20
21: ; preds = %21
br label %21
22: ; preds = %22
br label %22
23: ; No predecessors!
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
br label %26
26: ; preds = %26, %23
br label %26
27: ; No predecessors!
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
br label %30
30: ; preds = %30, %27
br label %30
31: ; preds = %31
br label %31
32: ; No predecessors!
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
br label %35
35: ; preds = %35, %32
br label %35
36: ; preds = %36
br label %36
37: ; No predecessors!
%38 = load i32, i32* %2
%39 = zext i32 %38 to i64
br label %40
40: ; preds = %40, %37
br label %40
41: ; preds = %41
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
br label %45
45: ; preds = %45, %42
br label %45
46: ; preds = %46
br label %46
}

LLVM IR (-O2):
define void @fd105(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
void av_stream_get_side_data() {}


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

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

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

LLVM IR (-O2):
define void @av_stream_get_side_data() {
ret void
}
int UDFICB(unsigned char *data, unsigned char *FileType,
           unsigned short *Flags) {
  *FileType = ((unsigned char)data[11]);
  *Flags = ((unsigned short)data[18] | ((unsigned short)data[(18) + 1] << 8));
  return 0;
}


x86 assembly (clang, -O0):
<UDFICB>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0xb(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movzbl 0x12(%rax),%eax
movzwl %ax,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x13(%rcx),%ecx
movzwl %cx,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UDFICB>:
mov    0xb(%rdi),%al
mov    %al,(%rsi)
movzwl 0x12(%rdi),%eax
mov    %ax,(%rdx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @UDFICB(i8* nocapture %0, i8* nocapture writeonly %1, i16* nocapture writeonly %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 11
%5 = load i8, i8* %4
store i8 %5, i8* %1
%6 = getelementptr inbounds i8, i8* %0, i64 18
%7 = load i8, i8* %6
%8 = zext i8 %7 to i16
%9 = getelementptr inbounds i8, i8* %0, i64 19
%10 = load i8, i8* %9
%11 = zext i8 %10 to i16
%12 = shl nuw i16 %11, 8
%13 = or i16 %12, %8
store i16 %13, i16* %2
ret i32 0
}
int shm_flush() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @shm_flush() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void brush_motor_OFF(void *brushmotor_address) {
  *((volatile int *)brushmotor_address + 3) = 0;
  usleep(50);
}


x86 assembly (clang, -O0):
<brush_motor_OFF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,0xc(%rax)
mov    $0x32,%edi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brush_motor_OFF>:
movl   $0x0,0xc(%rdi)
mov    $0x32,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @brush_motor_OFF(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 3
store volatile i32 0, i32* %5
%6 = call i32 @usleep(i32 50)
ret void
}

LLVM IR (-O2):
define void @brush_motor_OFF(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 12
%3 = bitcast i8* %2 to i32*
store volatile i32 0, i32* %3
%4 = tail call i32 @usleep(i32 50)
ret void
}
int test_imm_D7uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xD7 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D7uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 215
%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_D7uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 215
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ FlushCOM(int);
int /*<<< orphan*/ serial0_init(int);
int /*<<< orphan*/ serial1_init(int);
int OpenCOM(int portnum, char *port_zstr) {
  port_zstr = 0;
  if (portnum == 0) {
    serial0_init((256 - ((2 * 33000000) / (32L * 4 * 9600))));
  } else {
    serial1_init((256 - ((2 * 33000000) / (32L * 4 * 9600))));
  }
  FlushCOM(portnum);
  return 1;
}


x86 assembly (clang, -O0):
<OpenCOM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1160 <OpenCOM+0x30>
mov    $0xcb,%edi
call   1050 <serial0_init@plt>
jmp    116a <OpenCOM+0x3a>
mov    $0xcb,%edi
call   1030 <serial1_init@plt>
mov    -0x4(%rbp),%edi
call   1040 <FlushCOM@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OpenCOM>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
je     1143 <OpenCOM+0x13>
mov    $0xcb,%edi
call   1030 <serial1_init@plt>
jmp    114d <OpenCOM+0x1d>
mov    $0xcb,%edi
call   1050 <serial0_init@plt>
mov    %ebx,%edi
call   1040 <FlushCOM@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @OpenCOM(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
store i8* null, i8** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @serial0_init(i32 203)
br label %11
9: ; preds = %2
%10 = call i32 @serial1_init(i32 203)
br label %11
11: ; preds = %9, %7
%12 = load i32, i32* %3
%13 = call i32 @FlushCOM(i32 %12)
ret i32 1
}

LLVM IR (-O2):
define i32 @OpenCOM(i32 %0, i8* nocapture readnone %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @serial0_init(i32 203)
br label %8
6: ; preds = %2
%7 = tail call i32 @serial1_init(i32 203)
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @FlushCOM(i32 %0)
ret i32 1
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printstring(char *);
int main(void) {
  char str[1024] = {};
  int i = 0;
  while ((str[i] = getchar()) != '\n') {
    i++;
  }
  str[i] = '\0';
  printstring(str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
movl   $0x0,-0x414(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movslq -0x414(%rbp),%rcx
mov    %al,-0x410(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     1194 <main+0x64>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    115f <main+0x2f>
movslq -0x414(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
lea    -0x410(%rbp),%rdi
call   1050 <printstring@plt>
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0xffffffffffffffff,%rbx
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x1(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1150 <main+0x20>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1050 <printstring@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ %8, %3 ], [ 0, %0 ]
%5 = tail call signext i8 (...) @getchar()
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %4
store i8 %5, i8* %6
%7 = icmp eq i8 %5, 10
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = and i64 %4, 4294967295
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %10
store i8 0, i8* %11
%12 = call i32 @printstring(i8* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ personality;

/* Variables and functions */
char *CG_ConfigString(int);
int /*<<< orphan*/ CG_LoadingString(char *);
int /*<<< orphan*/ Info_ValueForKey(char const *, char *);
int /*<<< orphan*/ Q_CleanStr(char *);
int /*<<< orphan*/ Q_strncpyz(char *, int /*<<< orphan*/, int);
void CG_LoadingClient(int clientNum) {
  const char *info;
  char personality[64];
  info = CG_ConfigString(((32 + 256) + 256) + clientNum);
  Q_strncpyz(personality, Info_ValueForKey(info, "n"), sizeof(personality));
  Q_CleanStr(personality);
  CG_LoadingString(personality);
}


x86 assembly (clang, -O0):
<CG_LoadingClient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x220,%edi
call   1060 <CG_ConfigString@plt>
mov    %rax,-0x10(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1040 <Info_ValueForKey@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
mov    $0x40,%edx
call   1070 <Q_strncpyz@plt>
lea    -0x50(%rbp),%rdi
call   1050 <Q_CleanStr@plt>
lea    -0x50(%rbp),%rdi
call   1030 <CG_LoadingString@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_LoadingClient>:
push   %rbx
sub    $0x40,%rsp
add    $0x220,%edi
call   1060 <CG_ConfigString@plt>
lea    0xe99(%rip),%rsi
mov    %rax,%rdi
call   1040 <Info_ValueForKey@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x40,%edx
call   1070 <Q_strncpyz@plt>
mov    %rbx,%rdi
call   1050 <Q_CleanStr@plt>
mov    %rbx,%rdi
call   1030 <CG_LoadingString@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"n\00"
define void @CG_LoadingClient(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [64 x i8]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 544, %5
%7 = call i8* @CG_ConfigString(i32 %6)
store i8* %7, i8** %3
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%9 = load i8*, i8** %3
%10 = call i32 @Info_ValueForKey(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @Q_strncpyz(i8* %8, i32 %10, i32 64)
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%13 = call i32 @Q_CleanStr(i8* %12)
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%15 = call i32 @CG_LoadingString(i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"n\00"
define void @CG_LoadingClient(i32 %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = add nsw i32 %0, 544
%5 = tail call i8* @CG_ConfigString(i32 %4)
%6 = tail call i32 @Info_ValueForKey(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @Q_strncpyz(i8* %3, i32 %6, i32 64)
%8 = call i32 @Q_CleanStr(i8* %3)
%9 = call i32 @CG_LoadingString(i8* %3)
ret void
}
int NDigits(int n) {
  int digits = 0;
  while (n) {
    n /= 10;
    digits++;
  }
  return digits;
}


x86 assembly (clang, -O0):
<NDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1134 <NDigits+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <NDigits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NDigits>:
xor    %eax,%eax
test   %edi,%edi
je     1132 <NDigits+0x32>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <NDigits+0x10>
ret

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

LLVM IR (-O2):
define i32 @NDigits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ llvm_fcmp_uno(double, double);
int llvm_fcmp_ueq(double X, double Y) { return X == Y || llvm_fcmp_uno(X, Y); }


x86 assembly (clang, -O0):
<llvm_fcmp_ueq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x11(%rbp)
jne    1142 <llvm_fcmp_ueq+0x32>
jp     1142 <llvm_fcmp_ueq+0x32>
jmp    115b <llvm_fcmp_ueq+0x4b>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <llvm_fcmp_uno@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llvm_fcmp_ueq>:
mov    $0x1,%eax
ucomisd %xmm1,%xmm0
jne    111e <llvm_fcmp_ueq+0xe>
jp     111e <llvm_fcmp_ueq+0xe>
ret
push   %rax
call   1030 <llvm_fcmp_uno@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @llvm_fcmp_ueq(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp oeq double %5, %6
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load double, double* %3
%10 = load double, double* %4
%11 = call i64 @llvm_fcmp_uno(double %9, double %10)
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %8, %2
%14 = phi i1 [ true, %2 ], [ %12, %8 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @llvm_fcmp_ueq(double %0, double %1) {
%3 = fcmp oeq double %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i64 @llvm_fcmp_uno(double %0, double %1)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ 1, %2 ], [ %7, %4 ]
ret i32 %9
}
int putenv(nameval)
char *nameval;
{
  char *equal = strchr(nameval, '=');
  char *value = (equal ? equal : "");
  return (setenv(nameval, value, 1));
}


x86 assembly (clang, -O0):
<putenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1156 <putenv+0x36>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1166 <putenv+0x46>
lea    0xea3(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1166 <putenv+0x46>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <setenv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putenv>:
push   %rbx
mov    %rdi,%rbx
mov    $0x3d,%esi
call   1040 <strchr@plt>
test   %rax,%rax
lea    0xec8(%rip),%rsi
cmovne %rax,%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <setenv@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @putenv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strchr(i8* %5, i32 61)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %3
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %9
%13 = phi i8* [ %10, %9 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %11 ]
store i8* %13, i8** %4
%14 = load i8*, i8** %2
%15 = load i8*, i8** %4
%16 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @setenv to i32 (i8*, i8*, i32, ...)*)(i8* %14, i8* %15, i32 1)
ret i32 %16
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @putenv(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 61)
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
%5 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @setenv to i32 (i8*, i8*, i32, ...)*)(i8* %0, i8* %4, i32 1)
ret i32 %5
}