xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ glViewport(int, int, int, int);
void reshape(int x, int y) {
  if (x < y)
    glViewport(0, (y - x) / 2, x, x);
  else
    glViewport((x - y) / 2, 0, y, y);
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114c <reshape+0x3c>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%ecx
xor    %edi,%edi
call   1030 <glViewport@plt>
jmp    1169 <reshape+0x59>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
call   1030 <glViewport@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
mov    %esi,%ecx
mov    %edi,%eax
sub    %esi,%eax
jge    112e <reshape+0x1e>
mov    %edi,%edx
sub    %edi,%ecx
mov    %ecx,%esi
shr    $0x1f,%esi
add    %ecx,%esi
sar    %esi
xor    %edi,%edi
mov    %edx,%ecx
jmp    1030 <glViewport@plt>
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
xor    %esi,%esi
mov    %ecx,%edx
jmp    1030 <glViewport@plt>

LLVM IR (-O0):
define void @reshape(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = sdiv i32 %11, 2
%13 = load i32, i32* %3
%14 = load i32, i32* %3
%15 = call i32 @glViewport(i32 0, i32 %12, i32 %13, i32 %14)
br label %24
16: ; preds = %2
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = sub nsw i32 %17, %18
%20 = sdiv i32 %19, 2
%21 = load i32, i32* %4
%22 = load i32, i32* %4
%23 = call i32 @glViewport(i32 %20, i32 0, i32 %21, i32 %22)
br label %24
24: ; preds = %16, %8
ret void
}

LLVM IR (-O2):
define void @reshape(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = sub nsw i32 %1, %0
%6 = sdiv i32 %5, 2
%7 = tail call i32 @glViewport(i32 0, i32 %6, i32 %0, i32 %0)
br label %12
8: ; preds = %2
%9 = sub nsw i32 %0, %1
%10 = sdiv i32 %9, 2
%11 = tail call i32 @glViewport(i32 %10, i32 0, i32 %1, i32 %1)
br label %12
12: ; preds = %8, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ndsctl_action(char *, char *, char *);
void ndsctl_password(void) {
  ndsctl_action("password", "Password set to %s.\n",
                "Failed to set password to %s.\n");
}


x86 assembly (clang, -O0):
<ndsctl_password>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee7(%rip),%rsi
lea    0xef5(%rip),%rdx
call   1030 <ndsctl_action@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndsctl_password>:
lea    0xee9(%rip),%rdi
lea    0xeeb(%rip),%rsi
lea    0xef9(%rip),%rdx
jmp    1030 <ndsctl_action@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"password\00"
@.str.1 = [21 x i8] c"Password set to %s.\0A\00"
@.str.2 = [31 x i8] c"Failed to set password to %s.\0A\00"
define void @ndsctl_password() {
%1 = call i32 @ndsctl_action(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"password\00"
@.str.1 = [21 x i8] c"Password set to %s.\0A\00"
@.str.2 = [31 x i8] c"Failed to set password to %s.\0A\00"
define void @ndsctl_password() {
%1 = tail call i32 @ndsctl_action(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
ret void
}
char is_black(char p) { return (p & (1 << 6)) == (1 << 6); }


x86 assembly (clang, -O0):
<is_black>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0x40,%eax
cmp    $0x40,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_black>:
mov    %edi,%eax
shr    $0x6,%al
and    $0x1,%al
ret

LLVM IR (-O0):
define signext i8 @is_black(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 64
%6 = icmp eq i32 %5, 64
%7 = zext i1 %6 to i32
%8 = trunc i32 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @is_black(i8 signext %0) {
%2 = lshr i8 %0, 6
%3 = and i8 %2, 1
ret i8 %3
}
int CharIndex(s, c)
char *s, c;
{
  register int n;
  for (n = 1; *s != '\0'; s++, n++) {
    if (*s == c)
      return (n);
  };
  return (0);
}


x86 assembly (clang, -O0):
<CharIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1162 <CharIndex+0x62>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1143 <CharIndex+0x43>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <CharIndex+0x69>
jmp    1148 <CharIndex+0x48>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <CharIndex+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CharIndex>:
mov    (%rdi),%dl
xor    %eax,%eax
test   %dl,%dl
je     1133 <CharIndex+0x33>
movsbl %sil,%esi
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %dl,%edx
cmp    %edx,%esi
je     1134 <CharIndex+0x34>
movzbl (%rdi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1120 <CharIndex+0x20>
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @CharIndex(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
%7 = trunc i32 %1 to i8
store i8* %0, i8** %4
store i8 %7, i8* %5
store i32 1, i32* %6
br label %8
8: ; preds = %23, %2
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %8
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %16, %18
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = load i32, i32* %6
store i32 %21, i32* %3
br label %29
22: ; preds = %13
br label %23
23: ; preds = %22
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %8
28: ; preds = %8
store i32 0, i32* %3
br label %29
29: ; preds = %28, %20
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @CharIndex(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %19, label %5
5: ; preds = %2
%6 = shl i32 %1, 24
%7 = ashr exact i32 %6, 24
br label %8
8: ; preds = %5, %14
%9 = phi i8 [ %3, %5 ], [ %17, %14 ]
%10 = phi i32 [ 1, %5 ], [ %16, %14 ]
%11 = phi i8* [ %0, %5 ], [ %15, %14 ]
%12 = sext i8 %9 to i32
%13 = icmp eq i32 %7, %12
br i1 %13, label %19, label %14
14: ; preds = %8
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = add nuw nsw i32 %10, 1
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %8
19: ; preds = %8, %14, %2
%20 = phi i32 [ 0, %2 ], [ 0, %14 ], [ %10, %8 ]
ret i32 %20
}
void swap_int(int *a, int *b) {
  if (a != b) {
    *a ^= *b;
    *b ^= *a;
    *a ^= *b;
  }
}


x86 assembly (clang, -O0):
<swap_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1144 <swap_int+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_int>:
cmp    %rsi,%rdi
je     1111 <swap_int+0x11>
mov    (%rdi),%eax
xor    (%rsi),%eax
mov    %eax,(%rdi)
xor    (%rsi),%eax
mov    %eax,(%rsi)
xor    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @swap_int(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 = icmp ne i32* %5, %6
br i1 %7, label %8, label %24
8: ; preds = %2
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = xor i32 %12, %10
store i32 %13, i32* %11
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
%18 = xor i32 %17, %15
store i32 %18, i32* %16
%19 = load i32*, i32** %4
%20 = load i32, i32* %19
%21 = load i32*, i32** %3
%22 = load i32, i32* %21
%23 = xor i32 %22, %20
store i32 %23, i32* %21
br label %24
24: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @swap_int(i32* %0, i32* %1) {
%3 = icmp eq i32* %0, %1
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = load i32, i32* %1
%6 = load i32, i32* %0
%7 = xor i32 %6, %5
store i32 %7, i32* %0
%8 = load i32, i32* %1
%9 = xor i32 %8, %7
store i32 %9, i32* %1
%10 = load i32, i32* %0
%11 = xor i32 %10, %9
store i32 %11, i32* %0
br label %12
12: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void test(int (*func)(), const char *msg) {
  if (func() != 0) {
    printf("Test failure: %s\n", msg);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   *-0x8(%rbp)
cmp    $0x0,%eax
je     115c <test+0x3c>
mov    -0x10(%rbp),%rsi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
call   *%rdi
test   %eax,%eax
jne    112e <test+0xe>
pop    %rbx
ret
lea    0xecb(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Test failure: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @test(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 = call i32 (...) %5()
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Test failure: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @test(i32 (...)* nocapture %0, i8* %1) {
%3 = tail call i32 (...) %0()
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pevent_free_token(char *);
void free_token(char *token) { pevent_free_token(token); }


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

x86 assembly (clang, -O2):
<free_token>:
jmp    1030 <pevent_free_token@plt>

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

LLVM IR (-O2):
define void @free_token(i8* %0) {
%2 = tail call i32 @pevent_free_token(i8* %0)
ret void
}
unsigned char ds1337_bcd_to_dec(unsigned char bcd, unsigned char ten_bits) {
  unsigned char dec;
  dec = ((bcd >> 4) & 0xFF >> ten_bits) * 10;
  dec += (bcd & 0xFF >> 4);
  return dec;
}


x86 assembly (clang, -O0):
<ds1337_bcd_to_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
movzbl -0x2(%rbp),%ecx
mov    $0xff,%edx
sar    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
imul   $0xa,%eax,%eax
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%ecx
and    $0xf,%ecx
movzbl -0x3(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds1337_bcd_to_dec>:
mov    %esi,%ecx
mov    %edi,%eax
shr    $0x4,%eax
mov    $0xff,%edx
shr    %cl,%edx
and    %eax,%edx
lea    (%rdx,%rdx,4),%eax
and    $0xf,%edi
lea    (%rdi,%rax,2),%eax
ret

LLVM IR (-O0):
define zeroext i8 @ds1337_bcd_to_dec(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = ashr i32 %7, 4
%9 = load i8, i8* %4
%10 = zext i8 %9 to i32
%11 = ashr i32 255, %10
%12 = and i32 %8, %11
%13 = mul nsw i32 %12, 10
%14 = trunc i32 %13 to i8
store i8 %14, i8* %5
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = and i32 %16, 15
%18 = load i8, i8* %5
%19 = zext i8 %18 to i32
%20 = add nsw i32 %19, %17
%21 = trunc i32 %20 to i8
store i8 %21, i8* %5
%22 = load i8, i8* %5
ret i8 %22
}

LLVM IR (-O2):
define zeroext i8 @ds1337_bcd_to_dec(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = lshr i32 %3, 4
%5 = zext i8 %1 to i32
%6 = lshr i32 255, %5
%7 = and i32 %6, %4
%8 = mul nuw nsw i32 %7, 10
%9 = and i32 %3, 15
%10 = add nuw nsw i32 %8, %9
%11 = trunc i32 %10 to i8
ret i8 %11
}
void xxxx(buf, n) char *buf;
int n;
{
  int i;
  unsigned char c;
  for (i = 0; i < n; i++) {
    c = (unsigned char)xxx(0);
    buf[i] ^= c;
  }
}


x86 assembly (clang, -O0):
<xxxx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1161 <xxxx+0x51>
xor    %edi,%edi
mov    $0x0,%al
call   1030 <xxx@plt>
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
xor    %esi,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <xxxx+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xxxx>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1146 <xxxx+0x36>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
xor    %eax,%eax
call   1030 <xxx@plt>
xor    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <xxxx+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @xxxx(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %13, %6 ]
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @xxx to i32 (i32, ...)*)(i32 0)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = trunc i32 %8 to i8
%12 = xor i8 %10, %11
store i8 %12, i8* %9
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %6
15: ; preds = %6, %2
ret void
}
int main() {
  int sum = 0;
  int i = 2;
  switch (i) {
  case 1:
    sum += 3;
    break;
  case 2:
    sum += 4;
    break;
  case 3:
    sum += 5;
    break;
  }
  return sum;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     114f <main+0x4f>
jmp    112d <main+0x2d>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     115d <main+0x5d>
jmp    113e <main+0x3e>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     116b <main+0x6b>
jmp    1174 <main+0x74>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <main+0x74>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <main+0x74>
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 2, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %14 [
i32 1, label %5
i32 2, label %8
i32 3, label %11
]
5: ; preds = %0
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 3
store i32 %7, i32* %2
br label %14
8: ; preds = %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 4
store i32 %10, i32* %2
br label %14
11: ; preds = %0
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 5
store i32 %13, i32* %2
br label %14
14: ; preds = %0, %11, %8, %5
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
main() {
  char name[] = "This is a String";
  print(name);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedc(%rip),%al
mov    %al,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rsp,%rdi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.name = [17 x i8] c"This is a String\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = bitcast [17 x i8]* %1 to i8*
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%4 = call i32 @print(i8* %3)
ret i32 0
}

LLVM IR (-O2):
@__const.main.name = [17 x i8] c"This is a String\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%3 = call i32 @print(i8* %2)
ret i32 0
}
void PKCS7_SIGNED_new(void) {}


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

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

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

LLVM IR (-O2):
define void @PKCS7_SIGNED_new() {
ret void
}
void insl(unsigned short port, void *addr, unsigned long count) {
  __asm__ __volatile__("rep ; ins"
                       "l"
                       : "=D"(addr), "=c"(count)
                       : "d"(port), "0"(addr), "1"(count));
}


x86 assembly (clang, -O0):
<insl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
rep insl (%dx),%es:(%rdi)
mov    %rdi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insl>:
mov    %rdx,%rcx
mov    %edi,%edx
mov    %rsi,%rdi
rep insl (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insl(i16 zeroext %0, i8* %1, i64 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i64
store i16 %0, i16* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i16, i16* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call { i8*, i64 } asm sideeffect "rep ; insl", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %7, i8* %8, i64 %9)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @insl(i16 zeroext %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "rep ; insl", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %0, i8* %1, i64 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
size_t fwrite(char const *, int, size_t, int /*<<< orphan*/ *);
size_t strlen(char const *);
int fputs(const char *str, FILE *stream) {
  size_t bytes = strlen(str);
  return fwrite(str, sizeof(char), bytes, stream) == bytes ? bytes : EOF;
}


x86 assembly (clang, -O0):
<fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fwrite@plt>
cmp    -0x18(%rbp),%rax
jne    116a <fputs+0x4a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1178 <fputs+0x58>
mov    0x2e77(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputs>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %r14,%rcx
call   1040 <fwrite@plt>
cmp    %rbx,%rax
je     1154 <fputs+0x34>
mov    0x2e96(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @fputs(i8* nocapture %0, i32* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @fwrite(i8* %0, i32 1, i64 %3, i32* %1)
%5 = icmp eq i64 %4, %3
%6 = load i32, i32* @EOF
%7 = zext i32 %6 to i64
%8 = select i1 %5, i64 %3, i64 %7
%9 = trunc i64 %8 to i32
ret i32 %9
}
/* Type definitions */
struct ars_packet {
  int dummy;
};

/* Variables and functions */
size_t ars_relative_size(struct ars_packet *, int /*<<< orphan*/);
size_t ars_packet_size(struct ars_packet *pkt) {
  return ars_relative_size(pkt, 0);
}


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

x86 assembly (clang, -O2):
<ars_packet_size>:
xor    %esi,%esi
jmp    1030 <ars_relative_size@plt>

LLVM IR (-O0):
%struct.ars_packet = type { i32 }
define i64 @ars_packet_size(%struct.ars_packet* %0) {
%2 = alloca %struct.ars_packet*
store %struct.ars_packet* %0, %struct.ars_packet** %2
%3 = load %struct.ars_packet*, %struct.ars_packet** %2
%4 = call i64 @ars_relative_size(%struct.ars_packet* %3, i32 0)
ret i64 %4
}

LLVM IR (-O2):
%struct.ars_packet = type { i32 }
define i64 @ars_packet_size(%struct.ars_packet* %0) {
%2 = tail call i64 @ars_relative_size(%struct.ars_packet* %0, i32 0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Cool Repo!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"Cool Repo!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"Cool Repo!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void RTThreadGetNativeState(void) {}


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

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

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

LLVM IR (-O2):
define void @RTThreadGetNativeState() {
ret void
}
int _is_space_or_newline(const char c) {
  if (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_is_space_or_newline>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     113e <_is_space_or_newline+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     113e <_is_space_or_newline+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0xd,%eax
je     113e <_is_space_or_newline+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    114a <_is_space_or_newline+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <_is_space_or_newline+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_space_or_newline>:
cmp    $0x20,%dil
ja     1120 <_is_space_or_newline+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100002600,%rdx
bt     %rcx,%rdx
jae    1120 <_is_space_or_newline+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @_is_space_or_newline(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 13, label %3
i8 10, label %3
i8 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
char *strchr(char const *, char);
unsigned char get_register_id(char reg) {
  const char *regs = "ABCXYZIJ";
  const char *p = strchr(regs, reg);
  return p ? (int)(size_t)(p - regs) : 0;
}


x86 assembly (clang, -O0):
<get_register_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1158 <get_register_id+0x48>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
jmp    1162 <get_register_id+0x52>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1162 <get_register_id+0x52>
mov    -0x1c(%rbp),%eax
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_register_id>:
push   %rbx
mov    %edi,%esi
lea    0xee6(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strchr@plt>
mov    %eax,%ecx
sub    %bl,%cl
xor    %edx,%edx
test   %rax,%rax
movzbl %cl,%eax
cmove  %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"ABCXYZIJ\00"
define zeroext i8 @get_register_id(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i8*
store i8 %0, i8* %2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %3
%6 = load i8, i8* %2
%7 = call i8* @strchr(i8* %5, i8 signext %6)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %17
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = load i8*, i8** %3
%13 = ptrtoint i8* %11 to i64
%14 = ptrtoint i8* %12 to i64
%15 = sub i64 %13, %14
%16 = trunc i64 %15 to i32
br label %18
17: ; preds = %1
br label %18
18: ; preds = %17, %10
%19 = phi i32 [ %16, %10 ], [ 0, %17 ]
%20 = trunc i32 %19 to i8
ret i8 %20
}

LLVM IR (-O2):
@.str = [9 x i8] c"ABCXYZIJ\00"
define zeroext i8 @get_register_id(i8 signext %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%3 = icmp eq i8* %2, null
%4 = ptrtoint i8* %2 to i64
%5 = trunc i64 %4 to i8
%6 = sub i8 %5, ptrtoint ([9 x i8]* @.str to i8)
%7 = select i1 %3, i8 0, i8 %6
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void XXERREUR(char *ch1, char *ch2) {
  fprintf(stderr, "XXERREUR : %s %s\n", ch1, ch2);
  exit(0);
}


x86 assembly (clang, -O0):
<XXERREUR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<XXERREUR>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"XXERREUR : %s %s\0A\00"
define void @XXERREUR(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"XXERREUR : %s %s\0A\00"
define void @XXERREUR(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%5 = tail call i32 @exit(i32 0)
unreachable
}
void dw_close() { return; }


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

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

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

LLVM IR (-O2):
define void @dw_close() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arm_asr(int /*<<< orphan*/);
int /*<<< orphan*/ t16_data_imm5_op(int);
void t16_asr_imm5() { arm_asr(t16_data_imm5_op(1)); }


x86 assembly (clang, -O0):
<t16_asr_imm5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1040 <t16_data_imm5_op@plt>
mov    %eax,%edi
call   1030 <arm_asr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t16_asr_imm5>:
push   %rax
mov    $0x1,%edi
call   1040 <t16_data_imm5_op@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <arm_asr@plt>

LLVM IR (-O0):
define void @t16_asr_imm5() {
%1 = call i32 @t16_data_imm5_op(i32 1)
%2 = call i32 @arm_asr(i32 %1)
ret void
}

LLVM IR (-O2):
define void @t16_asr_imm5() {
%1 = tail call i32 @t16_data_imm5_op(i32 1)
%2 = tail call i32 @arm_asr(i32 %1)
ret void
}
/* Variables and functions */
int __real_dup(int);
int win32_dup(int);
int __wrap_dup(int oldfd) {
  int rc;
  rc = win32_dup(oldfd);
  if (rc == -1)
    return -1;
  if (rc > 0)
    return rc;
  return __real_dup(oldfd);
}


x86 assembly (clang, -O0):
<__wrap_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <win32_dup@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    114c <__wrap_dup+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    116c <__wrap_dup+0x4c>
cmpl   $0x0,-0xc(%rbp)
jle    1161 <__wrap_dup+0x41>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116c <__wrap_dup+0x4c>
mov    -0x8(%rbp),%edi
call   1030 <__real_dup@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wrap_dup>:
push   %rbx
mov    %edi,%ebx
call   1040 <win32_dup@plt>
cmp    $0xffffffff,%eax
je     1133 <__wrap_dup+0x13>
test   %eax,%eax
jle    113a <__wrap_dup+0x1a>
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1030 <__real_dup@plt>

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

LLVM IR (-O2):
define i32 @__wrap_dup(i32 %0) {
%2 = tail call i32 @win32_dup(i32 %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = icmp sgt i32 %2, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @__real_dup(i32 %0)
br label %8
8: ; preds = %4, %1, %6
%9 = phi i32 [ %7, %6 ], [ -1, %1 ], [ %2, %4 ]
ret i32 %9
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
bool isOctal(char *str) {
  char *temp = malloc(strlen(str) + 1);
  strcpy(temp, str);
  if (temp[strlen(temp) - 1] == 'o')
    return true;
  return false;
}


x86 assembly (clang, -O0):
<isOctal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x6f,%eax
jne    1196 <isOctal+0x66>
movl   $0x1,-0x4(%rbp)
jmp    119d <isOctal+0x6d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOctal>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %eax,%rcx
xor    %eax,%eax
cmpb   $0x6f,-0x1(%rcx,%rbx,1)
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @isOctal(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
%6 = tail call i32 @strlen(i8* %4)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %4, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 111
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ write_ble8(void *, int /*<<< orphan*/);
void write_le8(void *dest, uint8_t val) { write_ble8(dest, val); }


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

x86 assembly (clang, -O2):
<write_le8>:
jmp    1030 <write_ble8@plt>

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

LLVM IR (-O2):
define void @write_le8(i8* %0, i32 %1) {
%3 = tail call i32 @write_ble8(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int ceil(double);
int floor(double);
int /*<<< orphan*/ modf(double, double *);
int rnd(float x) {
  double i, j;
  modf((double)x, &i);
  if (i <= 0.5)
    return (floor((double)x));
  else
    return (ceil((double)x));
}


x86 assembly (clang, -O0):
<rnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    -0x10(%rbp),%rdi
call   1040 <modf@plt>
movsd  0xea9(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1178 <rnd+0x48>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1050 <floor@plt>
mov    %eax,-0x4(%rbp)
jmp    1189 <rnd+0x59>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd>:
sub    $0x18,%rsp
cvtss2sd %xmm0,%xmm0
lea    0x10(%rsp),%rdi
movsd  %xmm0,0x8(%rsp)
call   1040 <modf@plt>
movsd  0xeb0(%rip),%xmm0
ucomisd 0x10(%rsp),%xmm0
jae    1167 <rnd+0x37>
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
jmp    1030 <ceil@plt>
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
jmp    1050 <floor@plt>

LLVM IR (-O0):
define i32 @rnd(float %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca double
%5 = alloca double
store float %0, float* %3
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = call i32 @modf(double %7, double* %4)
%9 = load double, double* %4
%10 = fcmp ole double %9, 5.000000e-01
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = call i32 @floor(double %13)
store i32 %14, i32* %2
br label %19
15: ; preds = %1
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call i32 @ceil(double %17)
store i32 %18, i32* %2
br label %19
19: ; preds = %15, %11
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @rnd(float %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = fpext float %0 to double
%5 = call i32 @modf(double %4, double* %2)
%6 = load double, double* %2
%7 = fcmp ugt double %6, 5.000000e-01
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @floor(double %4)
br label %12
10: ; preds = %1
%11 = tail call i32 @ceil(double %4)
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char const);
void printobj(const char *obj, int size) {
  int i;
  for (i = 0; i < size; i++) {
    putchar(obj[i]);
  }
}


x86 assembly (clang, -O0):
<printobj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <printobj+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printobj+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printobj>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1143 <printobj+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <printobj+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @printobj(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @putchar(i8 signext %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int dir_SetMacFileTypeAndCreator(char *, int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ strlen(char *);
int setMacFileTypeAndCreator(char *fileName, char *typeString,
                             char *creatorString) {
  return dir_SetMacFileTypeAndCreator(fileName, strlen(fileName), typeString,
                                      creatorString);
}


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

x86 assembly (clang, -O2):
<setMacFileTypeAndCreator>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r15,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <dir_SetMacFileTypeAndCreator@plt>

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

LLVM IR (-O2):
define i32 @setMacFileTypeAndCreator(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @dir_SetMacFileTypeAndCreator(i8* %0, i32 %4, i8* %1, i8* %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __NR_socketpair;
int syscall(int /*<<< orphan*/, int, int, int, int *);
__attribute__((always_)) int _syscall_socketpair(int domain, int type,
                                                 int protocol, int sv[2]) {
  return syscall(__NR_socketpair, domain, type, protocol, sv);
}


x86 assembly (clang, -O0):
<_syscall_socketpair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_syscall_socketpair>:
mov    %rcx,%r8
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
@__NR_socketpair = global i32 0
define i32 @_syscall_socketpair(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = load i32, i32* @__NR_socketpair
%6 = tail call i32 @syscall(i32 %5, i32 %0, i32 %1, i32 %2, i32* %3)
ret i32 %6
}
int flip_endian(int x) {
  int rtn = 0;
  int mask = (0x1 << 8) - 1;
  for (int i = 0; i < sizeof(int); i++) {
    rtn = rtn << 8;
    rtn += x & mask;
    x = x >> 8;
  }
  return rtn;
}


x86 assembly (clang, -O0):
<flip_endian>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xff,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
cmp    $0x4,%rax
jae    1156 <flip_endian+0x56>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111c <flip_endian+0x1c>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip_endian>:
mov    %edi,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @flip_endian(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 255, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %20, %1
%7 = load i32, i32* %5
%8 = sext i32 %7 to i64
%9 = icmp ult i64 %8, 4
br i1 %9, label %10, label %23
10: ; preds = %6
%11 = load i32, i32* %3
%12 = shl i32 %11, 8
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = and i32 %13, %14
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = ashr i32 %18, 8
store i32 %19, i32* %2
br label %20
20: ; preds = %10
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %6
23: ; preds = %6
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @flip_endian(i32 %0) {
%2 = call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void _div(int f_num1, int f_num2) {
  printf("%d / %d = %d\n", f_num1, f_num2, (f_num1 / f_num2));
}


x86 assembly (clang, -O0):
<_div>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_div>:
mov    %esi,%ecx
mov    %edi,%esi
mov    %edi,%eax
cltd
idiv   %ecx
lea    0xee0(%rip),%rdi
mov    %ecx,%edx
mov    %eax,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%d / %d = %d\0A\00"
define void @_div(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 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = sdiv i32 %7, %8
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d / %d = %d\0A\00"
define void @_div(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %3)
ret void
}