xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ mkdata(char *);
int main(int argc, char **argv) {
  for (++argv; --argc > 0; ++argv)
    mkdata(*argv);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1161 <main+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <mkdata@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1132 <main+0x22>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1144 <main+0x34>
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x8,%rbx
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx),%rdi
call   1030 <mkdata@plt>
add    $0x8,%rbx
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
ja     1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i8** [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %8, %4 ], [ %0, %2 ]
%7 = getelementptr inbounds i8*, i8** %5, i64 1
%8 = add nsw i32 %6, -1
%9 = load i8*, i8** %7
%10 = tail call i32 @mkdata(i8* %9)
%11 = icmp ugt i32 %6, 2
br i1 %11, label %4, label %12
12: ; preds = %4, %2
ret i32 0
}
/* Type definitions */
struct utmp {
  int dummy;
};

/* Variables and functions */
int t2p_orig_getutent_r(struct utmp *, struct utmp **);
int /*<<< orphan*/ time2posix_utmp(struct utmp *);
int getutent_r(struct utmp *ubuf, struct utmp **ubufp) {
  int res = t2p_orig_getutent_r(ubuf, ubufp);
  if (!res)
    time2posix_utmp(ubuf);
  return res;
}


x86 assembly (clang, -O0):
<getutent_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <t2p_orig_getutent_r@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1153 <getutent_r+0x33>
mov    -0x8(%rbp),%rdi
call   1030 <time2posix_utmp@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getutent_r>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <t2p_orig_getutent_r@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1139 <getutent_r+0x19>
mov    %rbx,%rdi
call   1030 <time2posix_utmp@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.utmp = type { i32 }
define i32 @getutent_r(%struct.utmp* %0, %struct.utmp** %1) {
%3 = alloca %struct.utmp*
%4 = alloca %struct.utmp**
%5 = alloca i32
store %struct.utmp* %0, %struct.utmp** %3
store %struct.utmp** %1, %struct.utmp*** %4
%6 = load %struct.utmp*, %struct.utmp** %3
%7 = load %struct.utmp**, %struct.utmp*** %4
%8 = call i32 @t2p_orig_getutent_r(%struct.utmp* %6, %struct.utmp** %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load %struct.utmp*, %struct.utmp** %3
%13 = call i32 @time2posix_utmp(%struct.utmp* %12)
br label %14
14: ; preds = %11, %2
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
%struct.utmp = type { i32 }
define i32 @getutent_r(%struct.utmp* %0, %struct.utmp** %1) {
%3 = tail call i32 @t2p_orig_getutent_r(%struct.utmp* %0, %struct.utmp** %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @time2posix_utmp(%struct.utmp* %0)
br label %7
7: ; preds = %5, %2
ret i32 %3
}
/* Variables and functions */
int fremovexattr(int, char const *);
int smack_remove_label_for_file(int fd, const char *xattr) {
  return fremovexattr(fd, xattr);
}


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

x86 assembly (clang, -O2):
<smack_remove_label_for_file>:
jmp    1030 <fremovexattr@plt>

LLVM IR (-O0):
define i32 @smack_remove_label_for_file(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 = load i8*, i8** %4
%7 = call i32 @fremovexattr(i32 %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @smack_remove_label_for_file(i32 %0, i8* %1) {
%3 = tail call i32 @fremovexattr(i32 %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
main() {
  printf("ERROR: No locking available. Running Samba would be unsafe\n");
  exit(1);
  printf("WARNING: No automated network interface determination\n");
  printf("ERROR: no seteuid method available\n");
  exit(1);
  printf("ERROR: No disk free routine!\n");
  exit(1);
  printf("ERROR: No random or srandom routine!\n");
  exit(1);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [60 x i8] c"ERROR: No locking available. Running Samba would be unsafe\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [59 x i8] c"ERROR: No locking available. Running Samba would be unsafe\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, char *);
void scanf_alter(char **input) { scanf("%[29]", *input); }


x86 assembly (clang, -O0):
<scanf_alter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xed6(%rip),%rdi
call   1030 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scanf_alter>:
mov    (%rdi),%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <scanf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%[29]\00"
define void @scanf_alter(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
char *Strdup(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int /*<<< orphan*/);
char *response200(off_t length) {
  char response[256];
  snprintf(response, 256,
           "HTTP/1.1 200 OK\r\n"
           "Content-Type: */*\r\n"
           "Server: WDLS/1.0.0(Unix)\r\n"
           "Content-Length: %ld\r\n"
           "Connection: Close\r\n\r\n",
           length);
  return Strdup(response);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x100,%esi
lea    0xebc(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <Strdup@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
sub    $0x100,%rsp
mov    %edi,%ecx
lea    0xecf(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <Strdup@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [105 x i8] c"HTTP/1.1 200 OK\0D\0AContent-Type: */*\0D\0AServer: WDLS/1.0.0(Unix)\0D\0AContent-Length: %ld\0D\0AConnection: Close\0D\0A\0D\0A\00"
define i8* @response200(i32 %0) {
%2 = alloca i32
%3 = alloca [256 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @snprintf(i8* %4, i32 256, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = call i8* @Strdup(i8* %7)
ret i8* %8
}

LLVM IR (-O2):
@.str = [105 x i8] c"HTTP/1.1 200 OK\0D\0AContent-Type: */*\0D\0AServer: WDLS/1.0.0(Unix)\0D\0AContent-Length: %ld\0D\0AConnection: Close\0D\0A\0D\0A\00"
define i8* @response200(i32 %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 256, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i8* @Strdup(i8* %3)
ret i8* %5
}
void genbgez_test() {}


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

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

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

LLVM IR (-O2):
define void @genbgez_test() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArray(int arr[], int n) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%d\t", arr[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printArray>:
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    1159 <printArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printArray(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %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 i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %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
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @printArray(i32* 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 i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %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
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
int filename_has_pattern(const char *filename) {
  if (strrchr(filename, '%') == (char *)NULL)
    return (0);
  else
    return (1);
}


x86 assembly (clang, -O0):
<filename_has_pattern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x25,%esi
call   1030 <strrchr@plt>
cmp    $0x0,%rax
jne    1140 <filename_has_pattern+0x30>
movl   $0x0,-0x4(%rbp)
jmp    1147 <filename_has_pattern+0x37>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filename_has_pattern>:
push   %rax
mov    $0x25,%esi
call   1030 <strrchr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @filename_has_pattern(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i8* @strrchr(i8* %4, i8 signext 37)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %9
8: ; preds = %1
store i32 1, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @filename_has_pattern(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 37)
%3 = icmp ne i8* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
double julian_yyyy_mm_dd_time_hhmm_to_julian(char *, char *);
double date_yyyy_mm_dd_hhmm_to_julian(char *yyyy_mm_dd, char *hhmm) {
  return julian_yyyy_mm_dd_time_hhmm_to_julian(yyyy_mm_dd, hhmm);
}


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

x86 assembly (clang, -O2):
<date_yyyy_mm_dd_hhmm_to_julian>:
jmp    1030 <julian_yyyy_mm_dd_time_hhmm_to_julian@plt>

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

LLVM IR (-O2):
define double @date_yyyy_mm_dd_hhmm_to_julian(i8* %0, i8* %1) {
%3 = tail call double @julian_yyyy_mm_dd_time_hhmm_to_julian(i8* %0, i8* %1)
ret double %3
}
void RandomFunc(unsigned char input[1], unsigned char output[1]) {
  unsigned char state[1];
  unsigned char local1;
  {
    state[0UL] = (input[0UL] + 914778474UL) * (unsigned char)22;
    local1 = 0UL;
    while (local1 < 1UL) {
      state[local1] = state[0UL] + state[0UL];
      local1++;
    }
    output[0UL] = state[0UL] + (unsigned char)231;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
add    $0x3686696a,%rax
imul   $0x16,%rax,%rax
mov    %al,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
cmp    $0x1,%rax
jae    1153 <RandomFunc+0x53>
movzbl -0x11(%rbp),%eax
movzbl -0x11(%rbp),%ecx
add    %ecx,%eax
mov    %al,%cl
movzbl -0x12(%rbp),%eax
mov    %cl,-0x11(%rbp,%rax,1)
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    1124 <RandomFunc+0x24>
movzbl -0x11(%rbp),%eax
add    $0xe7,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
movzbl (%rdi),%eax
imul   $0x2c,%eax,%eax
add    $0x1f,%al
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1 x i8]
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i64
%11 = add i64 %10, 914778474
%12 = mul i64 %11, 22
%13 = trunc i64 %12 to i8
%14 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 %13, i8* %14
store i8 0, i8* %6
br label %15
15: ; preds = %19, %2
%16 = load i8, i8* %6
%17 = zext i8 %16 to i64
%18 = icmp ult i64 %17, 1
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = add nsw i32 %22, %25
%27 = trunc i32 %26 to i8
%28 = load i8, i8* %6
%29 = zext i8 %28 to i64
%30 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 %29
store i8 %27, i8* %30
%31 = load i8, i8* %6
%32 = add i8 %31, 1
store i8 %32, i8* %6
br label %15
33: ; preds = %15
%34 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = add nsw i32 %36, 231
%38 = trunc i32 %37 to i8
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i64 0
store i8 %38, i8* %40
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = mul i8 %3, 44
%5 = add i8 %4, 31
store i8 %5, i8* %1
ret void
}
/* Variables and functions */
int atoi(char *);
void read_arg(char *arg, int *m, int *n) {
  switch (*arg) {
  case '-':
    *m = atoi(arg + 1);
    break;
  case '+':
    *n = atoi(arg + 1);
    break;
  }
}


x86 assembly (clang, -O0):
<read_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x2b,%eax
je     1167 <read_arg+0x57>
jmp    113c <read_arg+0x2c>
mov    -0x1c(%rbp),%eax
sub    $0x2d,%eax
jne    117c <read_arg+0x6c>
jmp    114d <read_arg+0x3d>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    117c <read_arg+0x6c>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_arg>:
push   %rbx
mov    %rsi,%rbx
movsbl (%rdi),%eax
cmp    $0x2d,%eax
je     1124 <read_arg+0x14>
cmp    $0x2b,%eax
jne    112f <read_arg+0x1f>
mov    %rdx,%rbx
add    $0x1,%rdi
call   1030 <atoi@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @read_arg(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
switch i32 %9, label %20 [
i32 45, label %10
i32 43, label %15
]
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = call i32 @atoi(i8* %12)
%14 = load i32*, i32** %5
store i32 %13, i32* %14
br label %20
15: ; preds = %3
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = call i32 @atoi(i8* %17)
%19 = load i32*, i32** %6
store i32 %18, i32* %19
br label %20
20: ; preds = %3, %15, %10
ret void
}

LLVM IR (-O2):
define void @read_arg(i8* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = load i8, i8* %0
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 45, label %7
i32 43, label %6
]
6: ; preds = %3
br label %7
7: ; preds = %3, %6
%8 = phi i32* [ %2, %6 ], [ %1, %3 ]
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = tail call i32 @atoi(i8* %9)
store i32 %10, i32* %8
br label %11
11: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void setMode(int fd, int opMode) {
  char cmd[8];
  sprintf(cmd, "MD%d;", opMode);
  write(fd, cmd, strlen(cmd));
  usleep(100e3);
}


x86 assembly (clang, -O0):
<setMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xea4(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1060 <usleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setMode>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%edx
mov    %edi,%ebp
lea    0xeb2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1060 <usleep@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"MD%d;\00"
define void @setMode(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [8 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %4
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @write(i32 %9, i8* %10, i32 %12)
%14 = call i32 @usleep(i32 100000)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"MD%d;\00"
define void @setMode(i32 %0, i32 %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @write(i32 %0, i8* %4, i32 %6)
%8 = call i32 @usleep(i32 100000)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_CIPHER_CTX;

/* Variables and functions */
EVP_CIPHER_CTX *nothing(void) { return NULL; }


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

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

LLVM IR (-O0):
define i32* @nothing() {
ret i32* null
}

LLVM IR (-O2):
define noalias i32* @nothing() {
ret i32* null
}
int test_imm_50int64_highword_reg(long long val) {
  return ((val >> 32) & (0x50 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_50int64_highword_reg>:
movabs $0x5000000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_50int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 80
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_50int64_highword_reg(i64 %0) {
%2 = and i64 %0, 343597383680
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(short *, int, int, int /*<<< orphan*/ *);
int wav_write(short *buf, int len, FILE *wavfp) {
  int temp;
  if (!wavfp)
    return 0;
  temp = fwrite(buf, 1, len * 2, wavfp);
  if (temp <= 0)
    return 0;
  return temp;
}


x86 assembly (clang, -O0):
<wav_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    113a <wav_write+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1171 <wav_write+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fwrite@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jg     116b <wav_write+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1171 <wav_write+0x61>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wav_write>:
mov    %rdx,%rcx
test   %rdx,%rdx
je     1135 <wav_write+0x25>
push   %rax
mov    %esi,%edx
add    %esi,%edx
mov    $0x1,%esi
call   1030 <fwrite@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @wav_write(i16* %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i16*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i16* %0, i16** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%9 = load i32*, i32** %7
%10 = icmp ne i32* %9, null
br i1 %10, label %12, label %11
11: ; preds = %3
store i32 0, i32* %4
br label %23
12: ; preds = %3
%13 = load i16*, i16** %5
%14 = load i32, i32* %6
%15 = mul nsw i32 %14, 2
%16 = load i32*, i32** %7
%17 = call i32 @fwrite(i16* %13, i32 1, i32 %15, i32* %16)
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp sle i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %12
store i32 0, i32* %4
br label %23
21: ; preds = %12
%22 = load i32, i32* %8
store i32 %22, i32* %4
br label %23
23: ; preds = %21, %20, %11
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
define i32 @wav_write(i16* nocapture %0, i32 %1, i32* %2) {
%4 = icmp eq i32* %2, null
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = shl nsw i32 %1, 1
%7 = tail call i32 @fwrite(i16* %0, i32 1, i32 %6, i32* %2)
%8 = icmp sgt i32 %7, 0
%9 = select i1 %8, i32 %7, i32 0
br label %10
10: ; preds = %5, %3
%11 = phi i32 [ 0, %3 ], [ %9, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("usage:\n");
  printf("  wfr [weaponfile]\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"usage:\0A\00"
@.str.1 = [20 x i8] c" wfr [weaponfile]\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"usage:\00"
@str.2 = [19 x i8] c" wfr [weaponfile]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0))
ret void
}
int main() {
  int i;
  int j;
  j = 100;
  i = 0;
  while (i < j) {
    j = j + 1;
    i = i + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <main+0x3c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void arch_perfc_gather(void) {}


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

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

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

LLVM IR (-O2):
define void @arch_perfc_gather() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sum(char *, int, int, int, int, int /*<<< orphan*/);
int main(void) {
  sum("The total of 1+2+3+4 is %d\n", 1, 2, 3, 4, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
xor    %r9d,%r9d
call   1030 <sum@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
xor    %r9d,%r9d
call   1030 <sum@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"The total of 1+2+3+4 is %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sum(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 3, i32 4, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"The total of 1+2+3+4 is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @sum(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 3, i32 4, i32 0)
ret i32 0
}
int creat(path, mode) const char *path;
int mode;
{ return _creat(path, mode); }


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

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

LLVM IR (-O0):
define i32 @creat(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 (i8*, i32, ...) bitcast (i32 (...)* @_creat to i32 (i8*, i32, ...)*)(i8* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @creat(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @_creat to i32 (i8*, i32, ...)*)(i8* %0, i32 %1)
ret i32 %3
}
char *hello() { return "hello"; }


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

x86 assembly (clang, -O2):
<hello>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
define i8* @hello() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i8* @hello() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print_symbols(char symbol, int cnt) {
  while (cnt-- > 0)
    putchar(symbol);
}


x86 assembly (clang, -O0):
<print_symbols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    1143 <print_symbols+0x33>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    1121 <print_symbols+0x11>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_symbols>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    112f <print_symbols+0x1f>
mov    %esi,%ebx
add    $0x1,%ebx
movsbl %dil,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <print_symbols+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @print_symbols(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %9, %2
%6 = load i32, i32* %4
%7 = add nsw i32 %6, -1
store i32 %7, i32* %4
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i8, i8* %3
%11 = call i32 @putchar(i8 signext %10)
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @print_symbols(i8 signext %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %1, %2 ]
%6 = add nsw i32 %5, -1
%7 = tail call i32 @putchar(i8 signext %0)
%8 = icmp ugt i32 %5, 1
br i1 %8, label %4, label %9
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void someFunction(const int b[], size_t startSudirript, size_t size) {
  if (startSudirript < size) {
    someFunction(b, startSudirript + 1, size);
    printf("%d", b[startSudirript]);
  }
  return;
}


x86 assembly (clang, -O0):
<someFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    116e <someFunction+0x4e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
mov    -0x18(%rbp),%rdx
call   1040 <someFunction@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<someFunction>:
cmp    %rdx,%rsi
jae    114f <someFunction+0x2f>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x1,%rsi
call   1040 <someFunction@plt>
mov    (%r14,%rbx,4),%esi
lea    0xebd(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @someFunction(i32* nocapture %0, i64 %1, i64 %2) {
%4 = icmp ult i64 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nuw i64 %1, 1
tail call void @someFunction(i32* %0, i64 %7, i64 %2)
%8 = getelementptr inbounds i32, i32* %0, i64 %1
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %5
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void uint32ToBuf(uint32_t val, uint8_t *buf) {
  buf[0] = (val >> 24) & 0xff;
  buf[1] = (val >> 16) & 0xff;
  buf[2] = (val >> 8) & 0xff;
  buf[3] = (val >> 0) & 0xff;
}


x86 assembly (clang, -O0):
<uint32ToBuf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x0,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint32ToBuf>:
mov    %edi,%eax
mov    %edi,%ecx
movzbl %ah,%edx
movzbl %al,%edi
shr    $0x18,%eax
mov    %eax,(%rsi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x4(%rsi)
mov    %edx,0x8(%rsi)
mov    %edi,0xc(%rsi)
ret

LLVM IR (-O0):
define void @uint32ToBuf(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 = ashr i32 %5, 24
%7 = and i32 %6, 255
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %3
%11 = ashr i32 %10, 16
%12 = and i32 %11, 255
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 %12, i32* %14
%15 = load i32, i32* %3
%16 = ashr i32 %15, 8
%17 = and i32 %16, 255
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
%20 = load i32, i32* %3
%21 = ashr i32 %20, 0
%22 = and i32 %21, 255
%23 = load i32*, i32** %4
%24 = getelementptr inbounds i32, i32* %23, i64 3
store i32 %22, i32* %24
ret void
}

LLVM IR (-O2):
define void @uint32ToBuf(i32 %0, i32* nocapture writeonly %1) {
%3 = lshr i32 %0, 24
store i32 %3, i32* %1
%4 = lshr i32 %0, 16
%5 = and i32 %4, 255
%6 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %5, i32* %6
%7 = lshr i32 %0, 8
%8 = and i32 %7, 255
%9 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %8, i32* %9
%10 = and i32 %0, 255
%11 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %10, i32* %11
ret void
}
void SSP1_IRQHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @SSP1_IRQHandler() {
ret void
}
int test_imm_FCuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xFC << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_FCuint64_lowword_reg>:
test   $0xfc,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_FCuint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 252
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_FCuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 252
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
char *langRomTypeSunriseIde() { return "Sunrise IDE"; }


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

x86 assembly (clang, -O2):
<langRomTypeSunriseIde>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Sunrise IDE\00"
define i8* @langRomTypeSunriseIde() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [12 x i8] c"Sunrise IDE\00"
define i8* @langRomTypeSunriseIde() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printArray(int *, int);
int main() {
  int a[3][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}};
  int *p = &a[0][0];
  printArray(p, 9);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0x9,%esi
call   1040 <printArray@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xf06(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x9,%esi
call   1030 <printArray@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [3 x [3 x i32]] [[3 x i32] [i32 0, i32 1, i32 2], [3 x i32] [i32 3, i32 4, i32 5], [3 x i32] [i32 6, i32 7, i32 8]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [3 x i32]]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [3 x [3 x i32]]* %2 to i8*
%5 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %2, i64 0, i64 0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = call i32 @printArray(i32* %7, i32 9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [3 x [3 x i32]] [[3 x i32] [i32 0, i32 1, i32 2], [3 x i32] [i32 3, i32 4, i32 5], [3 x i32] [i32 6, i32 7, i32 8]]
define i32 @main() {
%1 = alloca [3 x [3 x i32]]
%2 = bitcast [3 x [3 x i32]]* %1 to i8*
%3 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 0, i64 0
%4 = call i32 @printArray(i32* %3, i32 9)
ret i32 0
}
void __bar(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @cpu_emergency_stop_pt() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

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


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

x86 assembly (clang, -O2):
<test_mm_min_pi16>:
jmp    1030 <_mm_min_pi16@plt>

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

LLVM IR (-O2):
define i32 @test_mm_min_pi16(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_min_pi16(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int dup(int);
int open(char *, int /*<<< orphan*/);
int main(void) {
  char *path = "/etc/passwd";
  int fd = open(path, O_RDONLY);
  if (fd >= 0) {
    int fd2 = dup(fd);
    close(fd);
    if (fd2 >= 0)
      close(fd2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1193 <main+0x63>
mov    -0x14(%rbp),%edi
call   1030 <dup@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
cmpl   $0x0,-0x18(%rbp)
jl     118e <main+0x5e>
mov    -0x18(%rbp),%edi
call   1040 <close@plt>
jmp    1193 <main+0x63>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
lea    0xebd(%rip),%rdi
call   1050 <open@plt>
test   %eax,%eax
js     1169 <main+0x39>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <dup@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <close@plt>
test   %ebp,%ebp
js     1169 <main+0x39>
mov    %ebp,%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"/etc/passwd\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = load i8*, i8** %2
%6 = load i32, i32* @O_RDONLY
%7 = call i32 @open(i8* %5, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %0
%11 = load i32, i32* %3
%12 = call i32 @dup(i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = call i32 @close(i32 %13)
%15 = load i32, i32* %4
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i32, i32* %4
%19 = call i32 @close(i32 %18)
br label %20
20: ; preds = %17, %10
br label %21
21: ; preds = %20, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"/etc/passwd\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = tail call i32 @dup(i32 %2)
%6 = tail call i32 @close(i32 %2)
%7 = icmp sgt i32 %5, -1
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @close(i32 %5)
br label %10
10: ; preds = %4, %8, %0
ret i32 0
}
/* Variables and functions */
size_t strlen(const char *s) {
  int i = 0;
  if (!s)
    return 0;
  while (s[i])
    i++;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1127 <strlen+0x27>
movq   $0x0,-0x8(%rbp)
jmp    1154 <strlen+0x54>
jmp    112c <strlen+0x2c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     114c <strlen+0x4c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112c <strlen+0x2c>
movslq -0x14(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
test   %rdi,%rdi
je     111e <strlen+0x1e>
mov    $0xffffffffffffffff,%rax
nopl   0x0(%rax)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
mov    %eax,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = and i64 %4, 4294967295
br label %11
11: ; preds = %9, %1
%12 = phi i64 [ 0, %1 ], [ %10, %9 ]
ret i64 %12
}
void foo354(int p) {}


x86 assembly (clang, -O0):
<foo354>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo354(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @foo354(i32 %0) {
ret void
}