xunge/DecIR huggingface dataset:
const char *zm_getUnbindEventScope(int flag) {
  if (flag & 512)
    return "ZM_UNBIND_REQUEST";
  if (flag & 1024)
    return "ZM_UNBIND_ABORT";
  return "[internal error]";
}


x86 assembly (clang, -O0):
<zm_getUnbindEventScope>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
je     1128 <zm_getUnbindEventScope+0x28>
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <zm_getUnbindEventScope+0x54>
mov    -0xc(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
je     1149 <zm_getUnbindEventScope+0x49>
lea    0xed2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <zm_getUnbindEventScope+0x54>
lea    0xed2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zm_getUnbindEventScope>:
test   $0x400,%edi
lea    0xf15(%rip),%rax
lea    0xefe(%rip),%rcx
cmove  %rax,%rcx
test   $0x200,%edi
lea    0xedb(%rip),%rax
cmove  %rcx,%rax
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"ZM_UNBIND_REQUEST\00"
@.str.1 = [16 x i8] c"ZM_UNBIND_ABORT\00"
@.str.2 = [17 x i8] c"[internal error]\00"
define i8* @zm_getUnbindEventScope(i32 %0) {
%2 = and i32 %0, 512
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 1024
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0)
%7 = select i1 %3, i8* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
ret i8* %7
}
void disableInterrupts() { __asm__ volatile("cli"); }


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

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

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

LLVM IR (-O2):
define void @disableInterrupts() {
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ prerror(char *);
void oom(void) {
  prerror("ERROR: Out of memory!\n"
          "Virtual memory exhausted. "
          "Please close some applications, "
          "add more RAM or SWAP space.\n");
  exit(1);
}


x86 assembly (clang, -O0):
<oom>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <prerror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<oom>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <prerror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [109 x i8] c"ERROR: Out of memory!\0AVirtual memory exhausted. Please close some applications, add more RAM or SWAP space.\0A\00"
define void @oom() {
%1 = call i32 @prerror(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [109 x i8] c"ERROR: Out of memory!\0AVirtual memory exhausted. Please close some applications, add more RAM or SWAP space.\0A\00"
define void @oom() {
%1 = tail call i32 @prerror(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int get_regb(uint32_t insn) { return (insn & 0x00000f80) >> 7; }


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

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

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

LLVM IR (-O2):
define i32 @get_regb(i32 %0) {
%2 = lshr i32 %0, 7
%3 = and i32 %2, 31
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void nds32_aie_scanner_free(void *ptr) { free((char *)ptr); }


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

x86 assembly (clang, -O2):
<nds32_aie_scanner_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @nds32_aie_scanner_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int isid(int c) {
  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_';
}


x86 assembly (clang, -O0):
<isid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     1120 <isid+0x20>
mov    $0x1,%al
cmpl   $0x7a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1143 <isid+0x43>
cmpl   $0x41,-0x4(%rbp)
jl     1139 <isid+0x39>
mov    $0x1,%al
cmpl   $0x5a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1143 <isid+0x43>
cmpl   $0x5f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isid>:
mov    %edi,%eax
and    $0xffffffdf,%eax
add    $0xffffffbf,%eax
cmp    $0x1a,%eax
setb   %al
cmp    $0x5f,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 122
br i1 %7, label %17, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 65
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 90
br i1 %13, label %17, label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 95
br label %17
17: ; preds = %14, %11, %5
%18 = phi i1 [ true, %11 ], [ true, %5 ], [ %16, %14 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @isid(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = icmp eq i32 %0, 95
%6 = or i1 %5, %4
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long window;
};
typedef TYPE_1__ XButtonReleasedEvent;

/* Variables and functions */
void set_XButtonReleasedEvent_window(void *_p, unsigned long _v) {
  ((XButtonReleasedEvent *)_p)->window = (unsigned long)_v;
}


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

x86 assembly (clang, -O2):
<set_XButtonReleasedEvent_window>:
mov    %rsi,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_XButtonReleasedEvent_window(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
int HelpItem85(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem85() {
ret i32 0
}
int maximum(int numberA, int numberB) {
  if (numberA > numberB) {
    return numberA;
  } else {
    return numberB;
  }
}


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

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

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

LLVM IR (-O2):
define i32 @maximum(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, int);
void blocking_enable(int fd) {
  fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK);
}


x86 assembly (clang, -O0):
<blocking_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    %eax,%edx
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%edx
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blocking_enable>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ebc(%rip),%rax
mov    (%rax),%ebp
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    0x2eb3(%rip),%rcx
mov    (%rcx),%edx
not    %edx
and    %eax,%edx
mov    %ebx,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
define void @blocking_enable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETFL
%5 = load i32, i32* %2
%6 = load i32, i32* @F_GETFL
%7 = call i32 @fcntl(i32 %5, i32 %6, i32 0)
%8 = load i32, i32* @O_NONBLOCK
%9 = xor i32 %8, -1
%10 = and i32 %7, %9
%11 = call i32 @fcntl(i32 %3, i32 %4, i32 %10)
ret void
}

LLVM IR (-O2):
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
define void @blocking_enable(i32 %0) {
%2 = load i32, i32* @F_SETFL
%3 = load i32, i32* @F_GETFL
%4 = tail call i32 @fcntl(i32 %0, i32 %3, i32 0)
%5 = load i32, i32* @O_NONBLOCK
%6 = xor i32 %5, -1
%7 = and i32 %4, %6
%8 = tail call i32 @fcntl(i32 %0, i32 %2, i32 %7)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void op_ld_16(void *_a, void *_b) {
  uint16_t *a = (uint16_t *)_a;
  uint16_t *b = (uint16_t *)_b;
  *a = *b;
}


x86 assembly (clang, -O0):
<op_ld_16>:
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),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_ld_16>:
mov    (%rsi),%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @op_ld_16(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = load i32*, i32** %5
store i32 %12, i32* %13
ret void
}

LLVM IR (-O2):
define void @op_ld_16(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %4
store i32 %5, i32* %3
ret void
}
char bam_aux2A(const unsigned char *s) {
  int type = *s++;
  if (s == 0)
    return 0;
  if (type == 'A')
    return *(char *)s;
  else
    return 0;
}


x86 assembly (clang, -O0):
<bam_aux2A>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1131 <bam_aux2A+0x31>
movb   $0x0,-0x1(%rbp)
jmp    114d <bam_aux2A+0x4d>
cmpl   $0x41,-0x14(%rbp)
jne    1149 <bam_aux2A+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
jmp    114d <bam_aux2A+0x4d>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bam_aux2A>:
cmpb   $0x41,(%rdi)
jne    1109 <bam_aux2A+0x9>
mov    0x1(%rdi),%al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define signext i8 @bam_aux2A(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 65
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
br label %7
7: ; preds = %1, %4
%8 = phi i8 [ %6, %4 ], [ 0, %1 ]
ret i8 %8
}
int upsample(void *context, unsigned char pixel) { return pixel << (16 - 8); }


x86 assembly (clang, -O0):
<upsample>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
shl    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<upsample>:
mov    %esi,%eax
shl    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @upsample(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 8
ret i32 %7
}

LLVM IR (-O2):
define i32 @upsample(i8* nocapture readnone %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = shl nuw nsw i32 %3, 8
ret i32 %4
}
unsigned int power2(unsigned int size) {
  return (size && !(size & (size - 1)));
}


x86 assembly (clang, -O0):
<power2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112c <power2+0x2c>
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<power2>:
test   %edi,%edi
je     110f <power2+0xf>
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @power2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = sub i32 %7, 1
%9 = and i32 %6, %8
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br label %12
12: ; preds = %5, %1
%13 = phi i1 [ false, %1 ], [ %11, %5 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @power2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.ctpop.i32(i32 %0)
%5 = icmp ult i32 %4, 2
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
ssize_t __readlink(const char *path, char *buf, size_t len) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__readlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @__readlink(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* @ENOSYS
%8 = call i32 @__set_errno(i32 %7)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__readlink(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
%4 = load i32, i32* @ENOSYS
%5 = tail call i32 @__set_errno(i32 %4)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void disconnect_socket(int sockfd) {
  if (sockfd != -1) {
    close(sockfd);
  }
}


x86 assembly (clang, -O0):
<disconnect_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     112d <disconnect_socket+0x1d>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disconnect_socket>:
cmp    $0xffffffff,%edi
je     111a <disconnect_socket+0xa>
jmp    1030 <close@plt>
ret

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

LLVM IR (-O2):
define void @disconnect_socket(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @close(i32 %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
char *strdup(char const *);
char *safe_strdup(const char *str) {
  char *new_str = NULL;
  if (str != NULL) {
    new_str = strdup(str);
    if (new_str == NULL) {
      fprintf(stderr, "ERROR: MALLOC FAILURE!\n");
      exit(1);
    }
  }
  return new_str;
}


x86 assembly (clang, -O0):
<safe_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118b <safe_strdup+0x5b>
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1186 <safe_strdup+0x56>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    118b <safe_strdup+0x5b>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_strdup>:
push   %rax
test   %rdi,%rdi
je     1142 <safe_strdup+0x12>
call   1050 <strdup@plt>
test   %rax,%rax
je     1146 <safe_strdup+0x16>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"ERROR: MALLOC FAILURE!\0A\00"
define noalias i8* @safe_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i8* @strdup(i8* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3, %1
%11 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ cbmarch_iec_set(int, int);
void cbm_iec_set(int HandleDevice, int Line) {
  ;
  cbmarch_iec_set(HandleDevice, Line);
  return;
}


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

x86 assembly (clang, -O2):
<cbm_iec_set>:
jmp    1030 <cbmarch_iec_set@plt>

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

LLVM IR (-O2):
define void @cbm_iec_set(i32 %0, i32 %1) {
%3 = tail call i32 @cbmarch_iec_set(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ desa_ascii(char);
void desa_reg(int reg) { desa_ascii(((reg & 8) ? 'A0' : 'D0') + (reg & 7)); }


x86 assembly (clang, -O0):
<desa_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x8,%edx
mov    $0x4430,%eax
mov    $0x4130,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0x7,%ecx
add    %ecx,%eax
movsbl %al,%edi
call   1030 <desa_ascii@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<desa_reg>:
and    $0x7,%dil
or     $0x30,%dil
movzbl %dil,%edi
jmp    1030 <desa_ascii@plt>

LLVM IR (-O0):
define void @desa_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 8
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 16688, i32 17456
%8 = load i32, i32* %2
%9 = and i32 %8, 7
%10 = add nsw i32 %7, %9
%11 = trunc i32 %10 to i8
%12 = call i32 @desa_ascii(i8 signext %11)
ret void
}

LLVM IR (-O2):
define void @desa_reg(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = and i8 %2, 7
%4 = or i8 %3, 48
%5 = tail call i32 @desa_ascii(i8 signext %4)
ret void
}
/* Type definitions */
struct kexec_segment {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __NR_kexec_load;
long syscall(int /*<<< orphan*/, unsigned int, unsigned long,
             struct kexec_segment *, unsigned long);
long kexec_load(unsigned int entry, unsigned long nr_segments,
                struct kexec_segment *segment, unsigned long flags) {
  return syscall(__NR_kexec_load, entry, nr_segments, segment, flags);
}


x86 assembly (clang, -O0):
<kexec_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kexec_load>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.kexec_segment = type { i32 }
@__NR_kexec_load = global i32 0
define i64 @kexec_load(i32 %0, i64 %1, %struct.kexec_segment* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca %struct.kexec_segment*
%8 = alloca i64
store i32 %0, i32* %5
store i64 %1, i64* %6
store %struct.kexec_segment* %2, %struct.kexec_segment** %7
store i64 %3, i64* %8
%9 = load i32, i32* @__NR_kexec_load
%10 = load i32, i32* %5
%11 = load i64, i64* %6
%12 = load %struct.kexec_segment*, %struct.kexec_segment** %7
%13 = load i64, i64* %8
%14 = call i64 @syscall(i32 %9, i32 %10, i64 %11, %struct.kexec_segment* %12, i64 %13)
ret i64 %14
}

LLVM IR (-O2):
%struct.kexec_segment = type { i32 }
@__NR_kexec_load = global i32 0
define i64 @kexec_load(i32 %0, i64 %1, %struct.kexec_segment* %2, i64 %3) {
%5 = load i32, i32* @__NR_kexec_load
%6 = tail call i64 @syscall(i32 %5, i32 %0, i64 %1, %struct.kexec_segment* %2, i64 %3)
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ mix(int, int);
void main() { mix(1, 2); }


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

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

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @mix(i32 1, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void __attribute__((weak)) bar(void) { puts("bar in u1"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"bar in u1\00"
define weak void @bar() {
%1 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"bar in u1\00"
define weak void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char, char, char, char, char, char,
                          char, char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char s;
  scanf("%c", &s);
  printf("  %c\n %c%c%c\n%c%c%c%c%c", s, s, s, s, s, s, s, s, s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xedf(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x5(%rbp),%sil
mov    -0x5(%rbp),%dl
mov    -0x5(%rbp),%cl
mov    -0x5(%rbp),%r8b
mov    -0x5(%rbp),%r9b
mov    -0x5(%rbp),%r11b
mov    -0x5(%rbp),%r10b
mov    -0x5(%rbp),%al
lea    0xe9d(%rip),%rdi
movsbl %sil,%esi
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r11b,%r11d
mov    %r11d,(%rsp)
movsbl %r10b,%r10d
mov    %r10d,0x8(%rsp)
movsbl %al,%eax
mov    %eax,0x10(%rsp)
movsbl -0x5(%rbp),%eax
mov    %eax,0x18(%rsp)
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeed(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%ecx
lea    0xec2(%rip),%rdi
mov    %ecx,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
mov    %ecx,%r9d
push   %rcx
push   %rcx
push   %rcx
push   %rcx
call   1030 <printf@plt>
add    $0x20,%rsp
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [24 x i8] c" %c\0A %c%c%c\0A%c%c%c%c%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = load i8, i8* %2
%6 = load i8, i8* %2
%7 = load i8, i8* %2
%8 = load i8, i8* %2
%9 = load i8, i8* %2
%10 = load i8, i8* %2
%11 = load i8, i8* %2
%12 = load i8, i8* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 signext %4, i8 signext %5, i8 signext %6, i8 signext %7, i8 signext %8, i8 signext %9, i8 signext %10, i8 signext %11, i8 signext %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [24 x i8] c" %c\0A %c%c%c\0A%c%c%c%c%c\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 signext %3, i8 signext %3, i8 signext %3, i8 signext %3, i8 signext %3, i8 signext %3, i8 signext %3, i8 signext %3, i8 signext %3)
ret i32 0
}
ISR(USART_TX_vect) { usart_buffer_send(); }


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

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

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

LLVM IR (-O2):
define i32 @ISR(i32 %0) {
%2 = tail call i32 (...) @usart_buffer_send()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strdup(char const *);
char const *strtok_r(char *, char *, char **);
char *get_src(const char *pkt) {
  char *tmp = strdup(pkt);
  char *tmp_tok;
  char *ret;
  ret = strdup(strtok_r(tmp, " ", &tmp_tok));
  free(tmp);
  return ret;
}


x86 assembly (clang, -O0):
<get_src>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <strtok_r@plt>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_src>:
push   %r14
push   %rbx
push   %rax
call   1050 <strdup@plt>
mov    %rax,%rbx
lea    0xebd(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1040 <strtok_r@plt>
mov    %rax,%rdi
call   1050 <strdup@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define i8* @get_src(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i8* @strtok_r(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%10 = call i8* @strdup(i8* %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define noalias i8* @get_src(i8* nocapture %0) {
%2 = alloca i8*
%3 = tail call i8* @strdup(i8* %0)
%4 = bitcast i8** %2 to i8*
%5 = call i8* @strtok_r(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2)
%6 = call i8* @strdup(i8* %5)
%7 = call i32 @free(i8* %3)
ret i8* %6
}
/* Type definitions */
struct tm {
  int tm_year;
};

/* Variables and functions */
unsigned Sys_Year(void *t) { return ((struct tm *)t)->tm_year + 1900; }


x86 assembly (clang, -O0):
<Sys_Year>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x76c,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sys_Year>:
mov    $0x76c,%eax
add    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @Sys_Year(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.tm*
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1900
ret i32 %7
}

LLVM IR (-O2):
define i32 @Sys_Year(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1900
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ time_t;
typedef int suseconds_t;
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
void ya_sleep(time_t sec, suseconds_t usec) {
  struct timeval tv;
  tv.tv_sec = sec + usec / (1000000);
  tv.tv_usec = usec % (1000000);
  select(0, NULL, NULL, NULL, &tv);
}


x86 assembly (clang, -O0):
<ya_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x20(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ya_sleep>:
sub    $0x18,%rsp
movslq %esi,%rax
imul   $0x431bde83,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rdi
mov    %rdi,0x10(%rsp)
imul   $0xf4240,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define void @ya_sleep(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca %struct.timeval
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i64, i64* %3
%7 = load i32, i32* %4
%8 = sdiv i32 %7, 1000000
%9 = sext i32 %8 to i64
%10 = add nsw i64 %6, %9
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
store i64 %10, i64* %11
%12 = load i32, i32* %4
%13 = srem i32 %12, 1000000
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
store i32 %13, i32* %14
%15 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %5)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define void @ya_sleep(i64 %0, i32 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = sdiv i32 %1, 1000000
%6 = sext i32 %5 to i64
%7 = add nsw i64 %6, %0
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i64 %7, i64* %8
%9 = srem i32 %1, 1000000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i32 %9, i32* %10
%11 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret void
}
/* Variables and functions */
scalar_t__ floor(double);
int cbuiltin_entier(double x) { return (int)floor(x); }


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

x86 assembly (clang, -O2):
<cbuiltin_entier>:
jmp    1030 <floor@plt>

LLVM IR (-O0):
define i32 @cbuiltin_entier(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @floor(double %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @cbuiltin_entier(double %0) {
%2 = tail call i64 @floor(double %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
void SDIO_SetSDIOReadWaitMode(unsigned int SDIO_ReadWaitMode) {
  (*(volatile unsigned int *)((
      ((unsigned int)0x42000000) +
      (((((((unsigned int)0x40000000) + 0x10000) + 0x2C00) -
         ((unsigned int)0x40000000)) +
        0x2C) *
       32) +
      (0x0A * 4)))) = SDIO_ReadWaitMode;
}


x86 assembly (clang, -O0):
<SDIO_SetSDIOReadWaitMode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x422585a8,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SDIO_SetSDIOReadWaitMode>:
mov    %edi,0x422585a8
ret

LLVM IR (-O0):
define void @SDIO_SetSDIOReadWaitMode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store volatile i32 %3, i32* inttoptr (i64 1109755304 to i32*)
ret void
}

LLVM IR (-O2):
define void @SDIO_SetSDIOReadWaitMode(i32 %0) {
store volatile i32 %0, i32* inttoptr (i64 1109755304 to i32*)
ret void
}
void get_label_x(int i, char x[]) {
  if (i >= 8) {
    i++;
  }
  i += 65;
  x[0] = (char)i;
  x[1] = '\0';
  return;
}


x86 assembly (clang, -O0):
<get_label_x>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x8,-0x4(%rbp)
jl     111e <get_label_x+0x1e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_label_x>:
xor    %eax,%eax
cmp    $0x8,%edi
setge  %al
add    %edi,%eax
add    $0x41,%al
mov    %al,(%rsi)
movb   $0x0,0x1(%rsi)
ret

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

LLVM IR (-O2):
define void @get_label_x(i32 %0, i8* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 7
%4 = zext i1 %3 to i32
%5 = add nsw i32 %4, %0
%6 = trunc i32 %5 to i8
%7 = add i8 %6, 65
store i8 %7, i8* %1
%8 = getelementptr inbounds i8, i8* %1, i64 1
store i8 0, i8* %8
ret void
}
/* Variables and functions */
size_t strlen(const char *s) {
  size_t i = 0;
  while (s[i] != '\0')
    i++;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1136 <strlen+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
__attribute((always_)) f() {
  goto a;
a:
  return 3;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <f+0x9>
mov    $0x3,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f() {
br label %1
1: ; preds = %0
ret i32 3
}

LLVM IR (-O2):
define i32 @f() {
ret i32 3
}
/* Variables and functions */
char LowerChar(char);
int /*<<< orphan*/ assert(char *);
void ToLower(char *szStr) {
  assert(szStr);
  while (*szStr) {
    (*szStr) = LowerChar(*szStr);
    szStr++;
  }
}


x86 assembly (clang, -O0):
<ToLower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1167 <ToLower+0x47>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <LowerChar@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1135 <ToLower+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ToLower>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    (%rbx),%al
test   %al,%al
je     1156 <ToLower+0x36>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1040 <LowerChar@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <ToLower+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ToLower(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i8 [ %10, %5 ], [ %3, %1 ]
%7 = phi i8* [ %9, %5 ], [ %0, %1 ]
%8 = tail call signext i8 @LowerChar(i8 signext %6)
store i8 %8, i8* %7
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %1
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
bool is_palindrome(uint64_t n) {
  uint64_t reversed = 0, tmp = n;
  while (tmp) {
    reversed = 10 * reversed + (tmp % 10);
    tmp /= 10;
  }
  return reversed == n;
}


x86 assembly (clang, -O0):
<is_palindrome>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114b <is_palindrome+0x4b>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1114 <is_palindrome+0x14>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_palindrome>:
xor    %edx,%edx
test   %edi,%edi
je     1141 <is_palindrome+0x41>
mov    %edi,%eax
nopl   0x0(%rax,%rax,1)
lea    (%rdx,%rdx,4),%r8d
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rax
add    %esi,%eax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %ecx,%edx
sub    %esi,%edx
lea    (%rdx,%r8,2),%edx
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <is_palindrome+0x10>
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_palindrome(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ %0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = mul nsw i32 %5, 10
%7 = srem i32 %4, 10
%8 = add nsw i32 %7, %6
%9 = sdiv i32 %4, 10
%10 = add i32 %4, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %8, %3 ]
%14 = icmp eq i32 %13, %0
%15 = zext i1 %14 to i32
ret i32 %15
}
unsigned xrop3_82_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = S & D;
  stk2 = T | stk3;
  stk1 = D ^ stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_82_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_82_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
or     %ecx,%edi
xor    $0xff,%edi
not    %ecx
or     %eax,%ecx
and    %edi,%ecx
not    %eax
and    %esi,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_82_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = and i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %7
%27 = load i32, i32* %10
%28 = or i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %5
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = and i32 %32, %33
%35 = load i32, i32* %8
%36 = load i32, i32* %7
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = or i32 %34, %38
%40 = load i32, i32* %7
%41 = load i32, i32* %6
%42 = xor i32 %41, -1
%43 = and i32 %40, %42
%44 = load i32, i32* %5
%45 = and i32 %43, %44
%46 = or i32 %39, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @xrop3_82_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = or i32 %6, %3
%8 = xor i32 %7, 255
%9 = xor i32 %6, -1
%10 = or i32 %4, %9
%11 = and i32 %8, %10
%12 = xor i32 %4, -1
%13 = and i32 %12, %5
%14 = or i32 %11, %13
ret i32 %14
}