xunge/DecIR huggingface dataset:
void set16(void *buf_, unsigned offset, unsigned short val) {
  unsigned char *buf = (unsigned char *)buf_ + offset;
  buf[0] = val;
  buf[1] = val >> 8;
}


x86 assembly (clang, -O0):
<set16>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %ax,-0xe(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0xe(%rbp),%ax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
movzwl -0xe(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set16>:
mov    %esi,%eax
mov    %dx,(%rdi,%rax,1)
ret

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

LLVM IR (-O2):
define void @set16(i8* nocapture writeonly %0, i32 %1, i16 zeroext %2) {
%4 = zext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = trunc i16 %2 to i8
store i8 %6, i8* %5
%7 = lshr i16 %2, 8
%8 = trunc i16 %7 to i8
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %8, i8* %9
ret void
}
/* Variables and functions */
int code_convert(char const *, char const *, char *, size_t, char *, size_t);
int g2u(char *inbuf, size_t inlen, char *outbuf, size_t outlen) {
  const char *from = "utf-8";
  const char *to = "gb2312";
  return code_convert(to, from, inbuf, inlen, outbuf, outlen);
}


x86 assembly (clang, -O0):
<g2u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xed1(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xecc(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1030 <code_convert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2u>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee3(%rip),%rdi
lea    0xed6(%rip),%rsi
jmp    1030 <code_convert@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [7 x i8] c"gb2312\00"
define i32 @g2u(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %10
%11 = load i8*, i8** %10
%12 = load i8*, i8** %9
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = load i8*, i8** %7
%16 = load i64, i64* %8
%17 = call i32 @code_convert(i8* %11, i8* %12, i8* %13, i64 %14, i8* %15, i64 %16)
ret i32 %17
}

LLVM IR (-O2):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [7 x i8] c"gb2312\00"
define i32 @g2u(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = tail call i32 @code_convert(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1, i8* %2, i64 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ clrscr();
int /*<<< orphan*/ printf(char *);
main() {
  int i = 1;
  clrscr();
  switch (i) {
    do {
    case 1:
      printf("\nhello");
    case 0:
      printf("hai");
    } while (i--);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
call   1030 <clrscr@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1172 <main+0x52>
jmp    1150 <main+0x30>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1166 <main+0x46>
jmp    1197 <main+0x77>
jmp    1166 <main+0x46>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jne    1161 <main+0x41>
jmp    1197 <main+0x77>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <clrscr@plt>
lea    0xece(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
lea    0xec6(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"\0Ahello\00"
@.str.1 = [4 x i8] c"hai\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = call i32 (...) @clrscr()
%4 = load i32, i32* %2
switch i32 %4, label %16 [
i32 1, label %7
i32 0, label %9
]
5: ; No predecessors!
br label %6
6: ; preds = %11, %5
br label %7
7: ; preds = %0, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %0, %7
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9
%12 = load i32, i32* %2
%13 = add nsw i32 %12, -1
store i32 %13, i32* %2
%14 = icmp ne i32 %12, 0
br i1 %14, label %6, label %15
15: ; preds = %11
br label %16
16: ; preds = %15, %0
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [7 x i8] c"\0Ahello\00"
@.str.1 = [4 x i8] c"hai\00"
define i32 @main() {
%1 = tail call i32 (...) @clrscr()
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int mik_toascii(int c) { return (c & 0x7f); }


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

x86 assembly (clang, -O2):
<mik_toascii>:
mov    %edi,%eax
and    $0x7f,%eax
ret

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

LLVM IR (-O2):
define i32 @mik_toascii(i32 %0) {
%2 = and i32 %0, 127
ret i32 %2
}
unsigned long hashit(unsigned char *str) {
  unsigned long hash = 0;
  int c;
  while (c = *str++)
    hash = c + (hash << 6) + (hash << 16) - hash;
  return hash;
}


x86 assembly (clang, -O0):
<hashit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1155 <hashit+0x55>
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
shl    $0x10,%rcx
add    %rcx,%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hashit+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashit>:
mov    (%rdi),%cl
test   %cl,%cl
je     1129 <hashit+0x29>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%ecx
imul   $0x1003f,%rax,%rax
add    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hashit+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @hashit(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 0, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = zext i8 %5 to i64
%10 = mul i64 %7, 65599
%11 = add i64 %10, %9
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 0, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ sendBlink(int, int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sendConf(int, int);
void setRedAudio(int sockfd) {
  sendConf(sockfd, (1 << 7) | (3 << 3) | (1 << 1));
  sendBlink(sockfd, 0x13, 0, 0);
}


x86 assembly (clang, -O0):
<setRedAudio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x9a,%esi
call   1040 <sendConf@plt>
mov    -0x4(%rbp),%edi
mov    $0x13,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <sendBlink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setRedAudio>:
push   %rbx
mov    %edi,%ebx
mov    $0x9a,%esi
call   1040 <sendConf@plt>
mov    %ebx,%edi
mov    $0x13,%esi
xor    %edx,%edx
xor    %ecx,%ecx
pop    %rbx
jmp    1030 <sendBlink@plt>

LLVM IR (-O0):
define void @setRedAudio(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sendConf(i32 %3, i32 154)
%5 = load i32, i32* %2
%6 = call i32 @sendBlink(i32 %5, i32 19, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @setRedAudio(i32 %0) {
%2 = tail call i32 @sendConf(i32 %0, i32 154)
%3 = tail call i32 @sendBlink(i32 %0, i32 19, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int x();
main() {
  if (x() != 1)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <x@plt>
cmp    $0x1,%eax
je     1156 <main+0x26>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <x@plt>
cmp    $0x1,%eax
jne    1144 <main+0x14>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @x()
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
bool string_eq(const void *litem, const void *ritem) {
  char *lstring = (char *)litem;
  char *rstring = (char *)ritem;
  return strcmp(lstring, rstring) == 0;
}


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

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

LLVM IR (-O0):
define i32 @string_eq(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i64 @strcmp(i8* %9, i8* %10)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @string_eq(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct snmp_session {
  int dummy;
};
struct snmp_pdu {
  int dummy;
};

/* Variables and functions */
int snmp_async_send(struct snmp_session *, struct snmp_pdu *,
                    int /*<<< orphan*/, int /*<<< orphan*/);
int snmp_send(struct snmp_session *session, struct snmp_pdu *pdu) {
  return snmp_async_send(session, pdu, 0, 0);
}


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

x86 assembly (clang, -O2):
<snmp_send>:
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <snmp_async_send@plt>

LLVM IR (-O0):
%struct.snmp_session = type { i32 }
%struct.snmp_pdu = type { i32 }
define i32 @snmp_send(%struct.snmp_session* %0, %struct.snmp_pdu* %1) {
%3 = alloca %struct.snmp_session*
%4 = alloca %struct.snmp_pdu*
store %struct.snmp_session* %0, %struct.snmp_session** %3
store %struct.snmp_pdu* %1, %struct.snmp_pdu** %4
%5 = load %struct.snmp_session*, %struct.snmp_session** %3
%6 = load %struct.snmp_pdu*, %struct.snmp_pdu** %4
%7 = call i32 @snmp_async_send(%struct.snmp_session* %5, %struct.snmp_pdu* %6, i32 0, i32 0)
ret i32 %7
}

LLVM IR (-O2):
%struct.snmp_session = type { i32 }
%struct.snmp_pdu = type { i32 }
define i32 @snmp_send(%struct.snmp_session* %0, %struct.snmp_pdu* %1) {
%3 = tail call i32 @snmp_async_send(%struct.snmp_session* %0, %struct.snmp_pdu* %1, i32 0, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ generatePermutations(int);
int /*<<< orphan*/ getchar();
int main() {
  generatePermutations(4);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1040 <generatePermutations@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <generatePermutations@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @generatePermutations(i32 4)
%2 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @generatePermutations(i32 4)
%2 = tail call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abortmsgerrno(char *);
int fchdir(int);
void fchdirx(int dirfd) {
  int r = fchdir(dirfd);
  if (r == -1)
    abortmsgerrno("failed to fchdir");
}


x86 assembly (clang, -O0):
<fchdirx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <fchdir@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    114c <fchdirx+0x2c>
lea    0xeb9(%rip),%rdi
call   1040 <abortmsgerrno@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fchdirx>:
push   %rax
call   1030 <fchdir@plt>
cmp    $0xffffffff,%eax
je     112d <fchdirx+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1040 <abortmsgerrno@plt>

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

LLVM IR (-O2):
@.str = [17 x i8] c"failed to fchdir\00"
define void @fchdirx(i32 %0) {
%2 = tail call i32 @fchdir(i32 %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @abortmsgerrno(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M999_f(char *s) {
  debug("M999_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M999_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M999_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M999_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M999_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M999_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M999_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ clrtoeol();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ printw(char *, char *);
int /*<<< orphan*/ refresh();
void terminate(char *errormsg) {
  printw("%s", errormsg);
  clrtoeol();
  refresh();
  endwin();
  return;
}


x86 assembly (clang, -O0):
<terminate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <printw@plt>
mov    $0x0,%al
call   1060 <clrtoeol@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
mov    $0x0,%al
call   1050 <endwin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminate>:
push   %rax
mov    %rdi,%rsi
lea    0xeb5(%rip),%rdi
call   1030 <printw@plt>
xor    %eax,%eax
call   1060 <clrtoeol@plt>
xor    %eax,%eax
call   1040 <refresh@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <endwin@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @terminate(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @clrtoeol()
%6 = call i32 (...) @refresh()
%7 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @terminate(i8* %0) {
%2 = tail call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @clrtoeol()
%4 = tail call i32 (...) @refresh()
%5 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int getGCD(int, int);
unsigned int getLCM(int a, int b) { return (a * b) / getGCD(a, b); }


x86 assembly (clang, -O0):
<getLCM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <getGCD@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLCM>:
push   %rbx
mov    %esi,%ebx
imul   %edi,%ebx
call   1030 <getGCD@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getLCM(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 = mul nsw i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @getGCD(i32 %8, i32 %9)
%11 = sdiv i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @getLCM(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i32 @getGCD(i32 %0, i32 %1)
%5 = sdiv i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ is_pow2(unsigned long long);
unsigned long long align(unsigned long long x, unsigned long long alignment) {
  assert(is_pow2(alignment));
  return (x + (alignment - 1)) & ~(alignment - 1);
}


x86 assembly (clang, -O0):
<align>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <is_pow2@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<align>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <is_pow2@plt>
mov    %eax,%edi
call   1030 <assert@plt>
lea    (%r14,%rbx,1),%rax
add    $0xffffffffffffffff,%rax
neg    %rbx
and    %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @align(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = call i32 @is_pow2(i64 %5)
%7 = call i32 @assert(i32 %6)
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = sub i64 %9, 1
%11 = add i64 %8, %10
%12 = load i64, i64* %4
%13 = sub i64 %12, 1
%14 = xor i64 %13, -1
%15 = and i64 %11, %14
ret i64 %15
}

LLVM IR (-O2):
define i64 @align(i64 %0, i64 %1) {
%3 = tail call i32 @is_pow2(i64 %1)
%4 = tail call i32 @assert(i32 %3)
%5 = add i64 %0, -1
%6 = add i64 %5, %1
%7 = sub i64 0, %1
%8 = and i64 %6, %7
ret i64 %8
}
/* Variables and functions */
int f(int);
main() {
  int i;
  int j;
  int k;
  i = 1;
  j = 2;
  return f(j);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 2)
ret i32 %1
}
/* Type definitions */
struct _Locale_name_hint {
  int dummy;
};
struct _Locale_codecvt {
  int dummy;
};

/* Variables and functions */
scalar_t__ _Locale_create(char const *, int *);
struct _Locale_codecvt *_Locale_codecvt_create(const char *name,
                                               struct _Locale_name_hint *hint
                                               __attribute__((__unused__)),
                                               int *__err_code) {
  return (struct _Locale_codecvt *)_Locale_create(name, __err_code);
}


x86 assembly (clang, -O0):
<_Locale_codecvt_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <_Locale_create@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Locale_codecvt_create>:
mov    %rdx,%rsi
jmp    1030 <_Locale_create@plt>

LLVM IR (-O0):
%struct._Locale_codecvt = type { i32 }
%struct._Locale_name_hint = type { i32 }
define %struct._Locale_codecvt* @_Locale_codecvt_create(i8* %0, %struct._Locale_name_hint* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca %struct._Locale_name_hint*
%6 = alloca i32*
store i8* %0, i8** %4
store %struct._Locale_name_hint* %1, %struct._Locale_name_hint** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i32*, i32** %6
%9 = call i64 @_Locale_create(i8* %7, i32* %8)
%10 = inttoptr i64 %9 to %struct._Locale_codecvt*
ret %struct._Locale_codecvt* %10
}

LLVM IR (-O2):
%struct._Locale_codecvt = type { i32 }
%struct._Locale_name_hint = type { i32 }
define %struct._Locale_codecvt* @_Locale_codecvt_create(i8* %0, %struct._Locale_name_hint* nocapture readnone %1, i32* %2) {
%4 = tail call i64 @_Locale_create(i8* %0, i32* %2)
%5 = inttoptr i64 %4 to %struct._Locale_codecvt*
ret %struct._Locale_codecvt* %5
}
void fa22(int n) {
  {
    int b[n];
    goto a;
    {
      int c[n];
      0;
    }
    {
      int d[n];
      0;
    }
  a:;
    int e[n];
    0;
  };
  {
    int f[n];
    {
      int g[n];
      0;
    };
    {
      int h[n];
      0;
    };
    ;
    int i[n];
    0;
  };
  ;
  int j[n];
  0;
}


x86 assembly (clang, -O0):
<fa22>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rax,-0x50(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rax,-0x78(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rax,-0x88(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @fa22(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
store i32 %0, i32* %2
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %3
%22 = alloca i32, i64 %20
store i64 %20, i64* %4
br label %34
23: ; No predecessors!
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %5
%27 = alloca i32, i64 %25
store i64 %25, i64* %6
%28 = load i8*, i8** %5
%29 = load i32, i32* %2
%30 = zext i32 %29 to i64
%31 = call i8* @llvm.stacksave()
store i8* %31, i8** %7
%32 = alloca i32, i64 %30
store i64 %30, i64* %8
%33 = load i8*, i8** %7
br label %34
34: ; preds = %23, %1
%35 = load i32, i32* %2
%36 = zext i32 %35 to i64
%37 = alloca i32, i64 %36
store i64 %36, i64* %9
%38 = load i8*, i8** %3
%39 = load i32, i32* %2
%40 = zext i32 %39 to i64
%41 = call i8* @llvm.stacksave()
store i8* %41, i8** %10
%42 = alloca i32, i64 %40
store i64 %40, i64* %11
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
%45 = call i8* @llvm.stacksave()
store i8* %45, i8** %12
%46 = alloca i32, i64 %44
store i64 %44, i64* %13
%47 = load i8*, i8** %12
%48 = load i32, i32* %2
%49 = zext i32 %48 to i64
%50 = call i8* @llvm.stacksave()
store i8* %50, i8** %14
%51 = alloca i32, i64 %49
store i64 %49, i64* %15
%52 = load i8*, i8** %14
%53 = load i32, i32* %2
%54 = zext i32 %53 to i64
%55 = alloca i32, i64 %54
store i64 %54, i64* %16
%56 = load i8*, i8** %10
%57 = load i32, i32* %2
%58 = zext i32 %57 to i64
%59 = call i8* @llvm.stacksave()
store i8* %59, i8** %17
%60 = alloca i32, i64 %58
store i64 %58, i64* %18
%61 = load i8*, i8** %17
ret void
}

LLVM IR (-O2):
define void @fa22(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fread(void *, int, size_t, int /*<<< orphan*/ *);
size_t MyReadFile(FILE *file, void *data, size_t size) {
  if (size == 0)
    return 0;
  return fread(data, 1, size, file);
}


x86 assembly (clang, -O0):
<MyReadFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    113c <MyReadFile+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1156 <MyReadFile+0x46>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MyReadFile>:
test   %rdx,%rdx
je     1125 <MyReadFile+0x15>
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
jmp    1030 <fread@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @MyReadFile(i32* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i64 @fread(i8* %1, i32 1, i64 %2, i32* %0)
br label %7
7: ; preds = %3, %5
%8 = phi i64 [ %6, %5 ], [ 0, %3 ]
ret i64 %8
}
/* Variables and functions */
double atan2(double, double);
int calc_vec_to_deg(int vx, int vy) {
  double deg;
  deg = atan2((double)vy, (double)vx) * 1800.0 / 3.14159265;
  if (deg < 0.0)
    deg += 3600.0;
  return ((int)deg);
}


x86 assembly (clang, -O0):
<calc_vec_to_deg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  0xed3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    116a <calc_vec_to_deg+0x5a>
movsd  0xeb0(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_vec_to_deg>:
push   %rax
cvtsi2sd %esi,%xmm0
cvtsi2sd %edi,%xmm1
call   1030 <atan2@plt>
mulsd  0xeda(%rip),%xmm0
divsd  0xeda(%rip),%xmm0
movsd  0xeda(%rip),%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm0,%xmm3
orpd   %xmm1,%xmm3
cvttsd2si %xmm3,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @calc_vec_to_deg(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sitofp i32 %6 to double
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to double
%10 = call double @atan2(double %7, double %9)
%11 = fmul double %10, 1.800000e+03
%12 = fdiv double %11, 0x400921FB53C8D4F1
store double %12, double* %5
%13 = load double, double* %5
%14 = fcmp olt double %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load double, double* %5
%17 = fadd double %16, 3.600000e+03
store double %17, double* %5
br label %18
18: ; preds = %15, %2
%19 = load double, double* %5
%20 = fptosi double %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @calc_vec_to_deg(i32 %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = sitofp i32 %0 to double
%5 = tail call double @atan2(double %3, double %4)
%6 = fmul double %5, 1.800000e+03
%7 = fdiv double %6, 0x400921FB53C8D4F1
%8 = fcmp olt double %7, 0.000000e+00
%9 = fadd double %7, 3.600000e+03
%10 = select i1 %8, double %9, double %7
%11 = fptosi double %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ output(int /*<<< orphan*/, char *, char const *,
                          int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void check_rc(int rc, const char *fn) {
  if (rc != -1)
    return;
  output(LOG_ERR, "%s failed. %s", fn, strerror(errno));
  exit(1);
}


x86 assembly (clang, -O0):
<check_rc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     114f <check_rc+0x1f>
add    $0x20,%rsp
pop    %rbp
ret
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    %eax,%ecx
lea    0xe7f(%rip),%rsi
call   1030 <output@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<check_rc>:
cmp    $0xffffffff,%edi
je     1136 <check_rc+0x6>
ret
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x2e8d(%rip),%rax
mov    (%rax),%ebp
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xea6(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1030 <output@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@LOG_ERR = global i32 0
@.str = [14 x i8] c"%s failed. %s\00"
@errno = global i32 0
define void @check_rc(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 ne i32 %5, -1
br i1 %6, label %7, label %8
7: ; preds = %2
ret void
8: ; preds = %2
%9 = load i32, i32* @LOG_ERR
%10 = load i8*, i8** %4
%11 = load i32, i32* @errno
%12 = call i32 @strerror(i32 %11)
%13 = call i32 @output(i32 %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %12)
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [14 x i8] c"%s failed. %s\00"
@errno = global i32 0
define void @check_rc(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, -1
br i1 %3, label %5, label %4
4: ; preds = %2
ret void
5: ; preds = %2
%6 = load i32, i32* @LOG_ERR
%7 = load i32, i32* @errno
%8 = tail call i32 @strerror(i32 %7)
%9 = tail call i32 @output(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %8)
%10 = tail call i32 @exit(i32 1)
unreachable
}
void DMA_Reset(unsigned int Channel) {
  if (Channel > 14)
    return;
  *(volatile int *)((volatile void *)(0x20007000) + (Channel)*0x100 + 0x00) =
      1 << 31;
  while (*(volatile int *)((volatile void *)(0x20007000) + (Channel)*0x100 +
                           0x00) &
         1 << 31)
    ;
}


x86 assembly (clang, -O0):
<DMA_Reset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xe,-0x4(%rbp)
jbe    1116 <DMA_Reset+0x16>
jmp    1151 <DMA_Reset+0x51>
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x20007000,%eax
movl   $0x80000000,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x20007000,%eax
mov    (%rax,%rcx,1),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     1151 <DMA_Reset+0x51>
jmp    112c <DMA_Reset+0x2c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DMA_Reset>:
cmp    $0xe,%edi
ja     1129 <DMA_Reset+0x29>
mov    %edi,%eax
shl    $0x8,%rax
movl   $0x80000000,0x20007000(%rax)
cs nopw 0x0(%rax,%rax,1)
nop
cmpl   $0x0,0x20007000(%rax)
js     1120 <DMA_Reset+0x20>
ret

LLVM IR (-O0):
define void @DMA_Reset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ugt i32 %3, 14
br i1 %4, label %5, label %6
5: ; preds = %1
br label %24
6: ; preds = %1
%7 = load i32, i32* %2
%8 = mul i32 %7, 256
%9 = zext i32 %8 to i64
%10 = getelementptr i8, i8* inttoptr (i64 536899584 to i8*), i64 %9
%11 = getelementptr i8, i8* %10, i64 0
%12 = bitcast i8* %11 to i32*
store volatile i32 -2147483648, i32* %12
br label %13
13: ; preds = %23, %6
%14 = load i32, i32* %2
%15 = mul i32 %14, 256
%16 = zext i32 %15 to i64
%17 = getelementptr i8, i8* inttoptr (i64 536899584 to i8*), i64 %16
%18 = getelementptr i8, i8* %17, i64 0
%19 = bitcast i8* %18 to i32*
%20 = load volatile i32, i32* %19
%21 = and i32 %20, -2147483648
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %13
br label %13
24: ; preds = %5, %13
ret void
}

LLVM IR (-O2):
define void @DMA_Reset(i32 %0) {
%2 = icmp ugt i32 %0, 14
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = shl nuw nsw i32 %0, 8
%5 = zext i32 %4 to i64
%6 = getelementptr i8, i8* inttoptr (i64 536899584 to i8*), i64 %5
%7 = bitcast i8* %6 to i32*
store volatile i32 -2147483648, i32* %7
br label %8
8: ; preds = %8, %3
%9 = load volatile i32, i32* %7
%10 = icmp sgt i32 %9, -1
br i1 %10, label %11, label %8
11: ; preds = %8, %1
ret void
}
int f(int *ptr1, float *ptr2) { return ptr1 != ptr2; }


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

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

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

LLVM IR (-O2):
define i32 @f(i32* readnone %0, float* readnone %1) {
%3 = bitcast float* %1 to i32*
%4 = icmp ne i32* %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
scalar_t__ IFNAMSIZ;
unsigned long ifnamesiz() { return (unsigned long)IFNAMSIZ; }


x86 assembly (clang, -O0):
<ifnamesiz>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifnamesiz>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
@IFNAMSIZ = global i64 0
define i64 @ifnamesiz() {
%1 = load i64, i64* @IFNAMSIZ
ret i64 %1
}

LLVM IR (-O2):
@IFNAMSIZ = global i64 0
define i64 @ifnamesiz() {
%1 = load i64, i64* @IFNAMSIZ
ret i64 %1
}
int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.hda_codec = type opaque
%struct.hdmi_eld = type opaque
define i32 @snd_hda_eld_proc_new(%struct.hda_codec* %0, %struct.hdmi_eld* %1) {
%3 = alloca %struct.hda_codec*
%4 = alloca %struct.hdmi_eld*
store %struct.hda_codec* %0, %struct.hda_codec** %3
store %struct.hdmi_eld* %1, %struct.hdmi_eld** %4
ret i32 0
}

LLVM IR (-O2):
%struct.hda_codec = type opaque
%struct.hdmi_eld = type opaque
define i32 @snd_hda_eld_proc_new(%struct.hda_codec* nocapture readnone %0, %struct.hdmi_eld* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
void relu_init(float a, float b) { printf("relu_init: %f, %f\n", a, b); }


x86 assembly (clang, -O0):
<relu_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [19 x i8] c"relu_init: %f, %f\0A\00"
define void @relu_init(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), float %5, float %6)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"relu_init: %f, %f\0A\00"
define void @relu_init(float %0, float %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), float %0, float %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int main() {
  int b = 0;
  struct {
    unsigned int bit0 : 1;
    unsigned int bit1 : 1;
    unsigned int bit2 : 1;
    unsigned int bit3 : 1;
    unsigned int bit4 : 1;
    unsigned int bit5 : 1;
    unsigned int bit6 : 1;
    unsigned int bit7 : 1;
  } sdata = {0x01};
  while (sdata.bit0-- > 0) {
    b++;
    if (b > 100)
      break;
  }
  if (b != 1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %cl,%dl
mov    -0x10(%rbp),%cl
and    $0x1,%dl
and    $0xfe,%cl
or     %dl,%cl
mov    %cl,-0x10(%rbp)
cmp    $0x0,%eax
jbe    1172 <main+0x62>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jle    116d <main+0x5d>
jmp    1172 <main+0x62>
jmp    112f <main+0x1f>
cmpl   $0x1,-0x8(%rbp)
je     1183 <main+0x73>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.anon = type { i8, [3 x i8] }
@__const.main.sdata = %struct.anon { i8 1, [3 x i8] undef }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.anon
store i32 0, i32* %1
store i32 0, i32* %2
%4 = bitcast %struct.anon* %3 to i8*
br label %5
5: ; preds = %24, %0
%6 = bitcast %struct.anon* %3 to i8*
%7 = load i8, i8* %6
%8 = and i8 %7, 1
%9 = zext i8 %8 to i32
%10 = add i32 %9, -1
%11 = trunc i32 %10 to i8
%12 = load i8, i8* %6
%13 = and i8 %11, 1
%14 = and i8 %12, -2
%15 = or i8 %14, %13
store i8 %15, i8* %6
%16 = zext i8 %13 to i32
%17 = icmp ugt i32 %9, 0
br i1 %17, label %18, label %25
18: ; preds = %5
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = icmp sgt i32 %21, 100
br i1 %22, label %23, label %24
23: ; preds = %18
br label %25
24: ; preds = %18
br label %5
25: ; preds = %23, %5
%26 = load i32, i32* %2
%27 = icmp ne i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @abort()
unreachable
30: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ bkm_scale(long *, int);
int bkm_scale_by_power(long int *x, int base, int power) {
  while (power--)
    if (bkm_scale(x, base))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<bkm_scale_by_power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     115d <bkm_scale_by_power+0x4d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <bkm_scale@plt>
cmp    $0x0,%rax
je     1158 <bkm_scale_by_power+0x48>
movl   $0x1,-0x4(%rbp)
jmp    1164 <bkm_scale_by_power+0x54>
jmp    1122 <bkm_scale_by_power+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bkm_scale_by_power>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
add    $0x1,%ebx
nop
add    $0xffffffff,%ebx
je     113c <bkm_scale_by_power+0x2c>
mov    %rbp,%rdi
mov    %r14d,%esi
call   1030 <bkm_scale@plt>
test   %rax,%rax
je     1120 <bkm_scale_by_power+0x10>
mov    $0x1,%eax
jmp    113e <bkm_scale_by_power+0x2e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @bkm_scale_by_power(i64* %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %7, %3
%5 = phi i32 [ %2, %3 ], [ %8, %7 ]
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = add nsw i32 %5, -1
%9 = tail call i64 @bkm_scale(i64* %0, i32 %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %4, %7
%12 = phi i32 [ 1, %7 ], [ 0, %4 ]
ret i32 %12
}
/* Type definitions */
struct winsize {
  int ws_col;
};

/* Variables and functions */
struct winsize *get_winsize(int /*<<< orphan*/);
int get_width() {
  struct winsize *ws = get_winsize(0);
  return ws->ws_col;
}


x86 assembly (clang, -O0):
<get_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <get_winsize@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_width>:
push   %rax
xor    %edi,%edi
call   1030 <get_winsize@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.winsize = type { i32 }
define i32 @get_width() {
%1 = alloca %struct.winsize*
%2 = call %struct.winsize* @get_winsize(i32 0)
store %struct.winsize* %2, %struct.winsize** %1
%3 = load %struct.winsize*, %struct.winsize** %1
%4 = getelementptr inbounds %struct.winsize, %struct.winsize* %3, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.winsize = type { i32 }
define i32 @get_width() {
%1 = tail call %struct.winsize* @get_winsize(i32 0)
%2 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  char buf[256];
  puts("Query> ");
  gets(buf);
  printf("%s", buf);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
lea    -0x110(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x110(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Query> \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [256 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Query> \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}
void genldc1() {}


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

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

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

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